oracle.jsp.webutil.fileaccess
Class HttpUploadBean

oracle.jsp.webutil.fileaccess.HttpUploadBean

public class HttpUploadBean

This bean receives a form based mutlipart encoded stream containing files and writes them out to the specified destination, which may be a directory in a filesystem or a column in a database.


Constructor Summary
HttpUploadBean()
           
 
Method Summary
TypeMethod
 java.lang.String getDataColumn()
           
 java.lang.String getDestination()
           
 java.lang.String getDestinationType()
           
 java.lang.String getFileNameColumn()
           
 java.util.Enumeration getFileNames()
          return the list of file that were uploaded
 java.lang.String getFileType()
           
 java.lang.String getOverwrite()
           
 java.lang.String getPrefixColumn()
           
 java.lang.String getTable()
           
 void setBaseDir(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request)
           
 void setConnection(ConnBean cb)
           
 void setConnection(java.sql.Connection conn)
           
 void setDataColumn(java.lang.String s)
           
 void setDestination(java.lang.String s)
           
 void setDestinationType(int destType)
           
 void setDestinationType(java.lang.String destType)
           
 void setFileNameColumn(java.lang.String s)
           
 void setFileType(int i)
           
 void setFileType(java.lang.String s)
           
 void setOverwrite(boolean overwrite)
           
 void setOverwrite(java.lang.String s)
           
 void setPrefixColumn(java.lang.String s)
           
 void setTable(java.lang.String s)
           
 void upload(javax.servlet.http.HttpServletRequest req)
          Upload the files from the form based request
 

Constructor Detail

HttpUploadBean

public HttpUploadBean()
Method Detail

upload

public void upload(javax.servlet.http.HttpServletRequest req)
            throws FileAccessException
Upload the files from the form based request

Parameters:
req - HttpServletRequest

setOverwrite

public void setOverwrite(java.lang.String s)
                  throws FileAccessException
Parameters:
overwrite - The overwrite value allows overwriting of files and updating of the file data column. True is the default. Any other value will disallow overwriting.

setOverwrite

public void setOverwrite(boolean overwrite)
Parameters:
overwrite - the overwrite value to allow row update or overwriting existing files

setDestinationType

public void setDestinationType(java.lang.String destType)
                        throws FileAccessException
Parameters:
destinationType - The destination type is 'filesystem' or 'database'. 'filesystem' is the default.

setDestinationType

public void setDestinationType(int destType)
                        throws FileAccessException

setDestination

public void setDestination(java.lang.String s)
                    throws FileAccessException
Parameters:
destination - The destination value is the upload directory when destintaion type is 'filesystem'. It is the file prefix column value for database uploads. There is no default.

setFileType

public void setFileType(java.lang.String s)
                 throws FileAccessException
Parameters:
fileType - The file type indicates whether the file will be saved in a BLOB or CLOB column. 'binary' is the default which indicates a BLOB. Any other value will mean a CLOB. It currently has no effect on when the destination type is 'filesystem'.

setFileType

public void setFileType(int i)
                 throws FileAccessException

setTable

public void setTable(java.lang.String s)
              throws FileAccessException
Parameters:
tableName - The tableName for saving the file in the database. It defaults to fileaccess. The fileaccess table can be created with fileaccess.sql.

setPrefixColumn

public void setPrefixColumn(java.lang.String s)
                     throws FileAccessException
Parameters:
destColName - The destination column name in the table which will hold the file prefix or destination. It defaults to 'destination' to match the value in fileaccess.sql.

setFileNameColumn

public void setFileNameColumn(java.lang.String s)
                       throws FileAccessException
Parameters:
fileColName - The name of the column which will hold the file name It defaults to 'filename' to match the value in fileaccess.sql.

setDataColumn

public void setDataColumn(java.lang.String s)
                   throws FileAccessException
Parameters:
dataColName - The name of the BLOB or CLOB column which will hold the file. It defaults to 'data' to match the value in fileaccess.sql.

setConnection

public void setConnection(ConnBean cb)
Parameters:
connBean - The name of the connection bean which is created to create the connection to the database.

setConnection

public void setConnection(java.sql.Connection conn)

setBaseDir

public void setBaseDir(javax.servlet.ServletContext servletContext,
                       javax.servlet.http.HttpServletRequest request)
                throws FileAccessException
Parameters:
servletContext - - current ServletContext (application obj from jsp)
request - - current HttpServletRequest (request obj from jsp) for file system, the basedir is defined in WEB-INF/fileaccess.properties

getOverwrite

public java.lang.String getOverwrite()

getDestinationType

public java.lang.String getDestinationType()

getDestination

public java.lang.String getDestination()

getFileType

public java.lang.String getFileType()

getTable

public java.lang.String getTable()

getPrefixColumn

public java.lang.String getPrefixColumn()

getFileNameColumn

public java.lang.String getFileNameColumn()

getDataColumn

public java.lang.String getDataColumn()

getFileNames

public java.util.Enumeration getFileNames()
return the list of file that were uploaded
Parameters:
fileNames - Get the names of the files that were uploaded. not available from the corresponding tag