com.jspsmart.upload
Class SmartUpload

java.lang.Object
  |
  +--com.jspsmart.upload.SmartUpload

public class SmartUpload
extends java.lang.Object

The object which perfoms the upload. date: 11 Jul 2000


Field Summary
static int SAVE_AUTO
           
static int SAVE_PHYSICAL
           
static int SAVE_VIRTUAL
           
 
Constructor Summary
SmartUpload()
          SmartUpload Creates an new SmartUpload instance.
 
Method Summary
 void downloadField(java.sql.ResultSet rs, java.lang.String columnName, java.lang.String contentType, java.lang.String destFileName)
          downloadField Downloads a field from a database's table.
 void downloadFile(java.lang.String sourceFilePathName)
          Downloads a file.
 void downloadFile(java.lang.String sourceFilePathName, java.lang.String contentType)
          Downloads a file.
 void downloadFile(java.lang.String sourceFilePathName, java.lang.String contentType, java.lang.String destFileName)
          Downloads a file
 void downloadFile(java.lang.String sourceFilePathName, java.lang.String contentType, java.lang.String destFileName, int blockSize)
          Downloads a file.
 void fieldToFile(java.sql.ResultSet rs, java.lang.String columnName, java.lang.String destFilePathName)
          Save a field from a database's table to a file.
 byte getBinaryData(int index)
          getBinaryData Returns the byte corresponding to the table index containing the transmitted data.
 Files getFiles()
          getFiles Returns the collection of the uploaded files.
 Request getRequest()
          getRequest Returns the request object.
 int getSize()
          getSize Returns the total size of data uploaded.
 void init(javax.servlet.ServletConfig config)
          Deprecated. Since Version 2.1 of jspSmartUpload, use initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.
 void initialize(javax.servlet.jsp.PageContext pageContext)
          Initialize the object with implicits objects.
 void initialize(javax.servlet.ServletConfig config, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Initialize the object with implicits objects.
 void initialize(javax.servlet.ServletContext application, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.jsp.JspWriter out)
          Deprecated. initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.
 int save(java.lang.String destPathName)
          Saves all the uploaded files in the specified destination.
 int save(java.lang.String destPathName, int option)
          Saves all the uploaded files in the specified destination.
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Deprecated. Since Version 2.1 of jspSmartUpload, use initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.
 void setAllowedFilesList(java.lang.String allowedFilesList)
          Set the list of allowed files.
 void setContentDisposition(java.lang.String contentDisposition)
          Sets the Content Disposition.
 void setDeniedFilesList(java.lang.String deniedFilesList)
          Set the list of denied files.
 void setDenyPhysicalPath(boolean deny)
          Sets if the component deny physical path.
 void setForcePhysicalPath(boolean force)
          Sets if the component force physical path.
 void setMaxFileSize(long maxFileSize)
          Sets the maximum file size.
 void setTotalMaxFileSize(long totalMaxFileSize)
          Sets the total maximum file size.
 void upload()
          upload Uploads data from the form.
 void uploadInFile(java.lang.String destFilePathName)
          The uploadInFile method creates a new file with all data of the POST form.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAVE_AUTO

public static final int SAVE_AUTO

SAVE_VIRTUAL

public static final int SAVE_VIRTUAL

SAVE_PHYSICAL

public static final int SAVE_PHYSICAL
Constructor Detail

SmartUpload

public SmartUpload()
SmartUpload Creates an new SmartUpload instance.
Method Detail

init

public final void init(javax.servlet.ServletConfig config)
                throws javax.servlet.ServletException
Deprecated. Since Version 2.1 of jspSmartUpload, use initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.

init Initialize the object with the context configuration.

This method always must be called in first.

Parameters:
config - the config object

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Deprecated. Since Version 2.1 of jspSmartUpload, use initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.

service Initialize the object with the required Servlet objects.

This method always must be called after the init() method.

Parameters:
request - the request object.
response - the response object.

initialize

public final void initialize(javax.servlet.ServletConfig config,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException
Initialize the object with implicits objects. This method always must be called in first. This method is meant to be used when the component is called from a servlet (not a JSP page).
Parameters:
config - The application object.
request - The request object.
response - The response object.
Throws:
javax.servlet.ServletException -  

initialize

public final void initialize(javax.servlet.jsp.PageContext pageContext)
                      throws javax.servlet.ServletException
Initialize the object with implicits objects. This method always must be called in first.
Parameters:
pageContext - The pageContext object.
Throws:
javax.servlet.ServletException -  

initialize

public final void initialize(javax.servlet.ServletContext application,
                             javax.servlet.http.HttpSession session,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.jsp.JspWriter out)
                      throws javax.servlet.ServletException
Deprecated. initialize(javax.servlet.ServletConfig, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) instead.

Initialize the object with implicits objects. This method always must be called in first.
Parameters:
application - The application object.
session - The session object.
request - The request object.
response - The response object.
out - The out object.
Throws:
javax.servlet.ServletException -  

upload

public void upload()
            throws javax.servlet.ServletException,
                   java.io.IOException,
                   SmartUploadException
upload Uploads data from the form.

save

public int save(java.lang.String destPathName)
         throws javax.servlet.ServletException,
                java.io.IOException,
                SmartUploadException
Saves all the uploaded files in the specified destination.
Parameters:
destPathName - The destination path.

save

public int save(java.lang.String destPathName,
                int option)
         throws javax.servlet.ServletException,
                java.io.IOException,
                SmartUploadException
Saves all the uploaded files in the specified destination.
Parameters:
destPathName - The destination path.

getSize

public int getSize()
getSize Returns the total size of data uploaded.

getBinaryData

public byte getBinaryData(int index)
getBinaryData Returns the byte corresponding to the table index containing the transmitted data.
Parameters:
index - index of the Table.

getFiles

public Files getFiles()
getFiles Returns the collection of the uploaded files.
Returns:
The collection of the uploaded files.

getRequest

public Request getRequest()
getRequest Returns the request object.
Returns:
The request object.

downloadFile

public void downloadFile(java.lang.String sourceFilePathName)
                  throws javax.servlet.ServletException,
                         java.io.IOException,
                         SmartUploadException
Downloads a file.
Parameters:
sourceFilePathName - The full path to the file to download.

downloadFile

public void downloadFile(java.lang.String sourceFilePathName,
                         java.lang.String contentType)
                  throws javax.servlet.ServletException,
                         java.io.IOException,
                         SmartUploadException,
                         SmartUploadException
Downloads a file.
Parameters:
sourceFilePathName - The full path to the file to download.
contentType - the content type

downloadFile

public void downloadFile(java.lang.String sourceFilePathName,
                         java.lang.String contentType,
                         java.lang.String destFileName)
                  throws javax.servlet.ServletException,
                         java.io.IOException,
                         SmartUploadException
Downloads a file
Parameters:
sourceFilePathName - The full path to the file to download.
contentType - the content type.
destFileName - the suggested file name.

downloadFile

public void downloadFile(java.lang.String sourceFilePathName,
                         java.lang.String contentType,
                         java.lang.String destFileName,
                         int blockSize)
                  throws javax.servlet.ServletException,
                         java.io.IOException,
                         SmartUploadException
Downloads a file.
Parameters:
sourceFilePathName - The full path to the file to download.
contentType - the content type
destFileName - the suggested file name
blockSize -  

downloadField

public void downloadField(java.sql.ResultSet rs,
                          java.lang.String columnName,
                          java.lang.String contentType,
                          java.lang.String destFileName)
                   throws javax.servlet.ServletException,
                          java.io.IOException,
                          java.sql.SQLException
downloadField Downloads a field from a database's table.
Parameters:
rs - the resulstet.
columnName - the column name.
contentType - the content type.
destFileName - the suggested file name.

fieldToFile

public void fieldToFile(java.sql.ResultSet rs,
                        java.lang.String columnName,
                        java.lang.String destFilePathName)
                 throws javax.servlet.ServletException,
                        java.io.IOException,
                        SmartUploadException,
                        java.sql.SQLException
Save a field from a database's table to a file.
Parameters:
rs - the resulstet.
columnName - the column name.
destFileName - the suggested file name.

setDeniedFilesList

public void setDeniedFilesList(java.lang.String deniedFilesList)
                        throws javax.servlet.ServletException,
                               java.io.IOException,
                               java.sql.SQLException
Set the list of denied files.

Contains the list of file's extensions which are denied to be uploaded. If this list is empty then no files are denied. All the files with an extension in the DeniedFileslist are denied even if they are in the AllowedFilesList.

In order to deny the files without an extension the list must contain two commas ",,". By defect this property is empty.

Parameters:
deniedFilesList - The list of denied files

setAllowedFilesList

public void setAllowedFilesList(java.lang.String allowedFilesList)
Set the list of allowed files. Contains the list of file's extensions which are allowed to be uploaded. If this list is empty then all files are allowed. If the list is not empty then only the files with a specified extension are allowed.

In order to allow the files without extension list must contain two commas ",,". By defect this property is empty.

Parameters:
allowedFilesList - the list of allowed files

setDenyPhysicalPath

public void setDenyPhysicalPath(boolean deny)
Sets if the component deny physical path.

Prevents to access a path other that a virtual path of the Web Server. By defect this property is false.

Parameters:
denyPhysicalPath - is a boolean

setForcePhysicalPath

public void setForcePhysicalPath(boolean force)
Sets if the component force physical path.

By default, the component consider a path as a virtual path. To oblige the component to consider all path as physical path, set this property to true.

Parameters:
forcePhysicalPath - The boolean value.

setContentDisposition

public void setContentDisposition(java.lang.String contentDisposition)
Sets the Content Disposition. Contains the string of the Content Disposition Hearders for the MIME Type.
Parameters:
contentDisposition - The content disposition.

setTotalMaxFileSize

public void setTotalMaxFileSize(long totalMaxFileSize)
Sets the total maximum file size.

Is the maximum allowed size of all files to be uploaded. If this value is null then there is no limit for the total file's size uploaded. By defect this property is null.

Parameters:
totalMaxFileSize - the total max file size

setMaxFileSize

public void setMaxFileSize(long maxFileSize)
Sets the maximum file size.

Is the maximum allowed size of one file to be uploaded. If this value is null then there is no limit for the file's size uploaded. By defect this property is null.

Parameters:
maxFileSize - the max file size.

uploadInFile

public void uploadInFile(java.lang.String destFilePathName)
                  throws java.io.IOException,
                         SmartUploadException
The uploadInFile method creates a new file with all data of the POST form.

This method can't be called if the upload() method is already called.

Parameters:
destFilePathName - The path of the file.
Throws:
java.io.IOException -  
java.lang.SecurityException -  
SmartUploadException -