nextapp.echo2.webcontainer.filetransfer
Interface MultipartUploadSPI

All Superinterfaces:
WebRenderAction.MultipartRequestWrapper
All Known Implementing Classes:
AbstractFileUploadProvider, JakartaCommonsFileUploadProvider

public interface MultipartUploadSPI
extends WebRenderAction.MultipartRequestWrapper

This interface allows pluggable selection of the library to be used to parse the HttpServletRequest. Custom MultipartUploadSPI implementations may be configured by calling System.setProperty(MultipartUploadSPI.SYSTEM_PROPERTY_NAME, "com.example.CustomMultipartUploadSPI") from within an application entry point. The given fully qualified implementation class must implement a public default (no argument) constructor.


Field Summary
static java.lang.String SYSTEM_PROPERTY_NAME
           
 
Method Summary
 java.io.File getDiskCacheLocation()
          Gets the directory to be used for storing file uploads that exceed the memory cache threshold.
 int getFileUploadSizeLimit()
          Gets the maximum size, in bytes, of file uploads to be accepted.
 int getMemoryCacheThreshold()
          Gets the size, in bytes, that the file upload must exceed before being cached to disk.
 boolean supportsDiskCaching()
          Implementations return true if they support caching the uploaded file to disk.
 boolean supportsFileUploadSizeLimit()
          Implementations return true if they support limiting the size of the upload.
 void updateComponent(Connection conn, UploadSelect uploadSelect)
          Implementations use the information from the HttpServletRequest in the Connection to call the fileUpload() method of the UploadSelect component.
 
Methods inherited from interface nextapp.echo2.webrender.WebRenderAction.MultipartRequestWrapper
getWrappedRequest
 

Field Detail

SYSTEM_PROPERTY_NAME

static final java.lang.String SYSTEM_PROPERTY_NAME
See Also:
Constant Field Values
Method Detail

supportsDiskCaching

boolean supportsDiskCaching()
Implementations return true if they support caching the uploaded file to disk. Implementations that return true must not throw UnsupportedOperationExceptions for the methods setMemoryCacheThreshold() and setDiskCacheLocation().

Returns:
true if the implementation is able to conserve memory by storing the uploaded file to disk

supportsFileUploadSizeLimit

boolean supportsFileUploadSizeLimit()
Implementations return true if they support limiting the size of the upload. Implementations that return true must not throw an UnsupportedOperationException for the method setFileUploadSizeLimit().

Returns:
true if the implmentation is able to terminate uploads larger than a specified size

updateComponent

void updateComponent(Connection conn,
                     UploadSelect uploadSelect)
                     throws java.io.IOException,
                            ServletException
Implementations use the information from the HttpServletRequest in the Connection to call the fileUpload() method of the UploadSelect component.

Parameters:
conn - provides access to the HttpServletRequest
uploadSelect - component to be updated with the file upload information
Throws:
java.io.IOException - if the Connection or the HttpServletRequest throws an IOException during the operation
ServletException - if Connection or the HttpServletRequest throws an IOException during the operation

getMemoryCacheThreshold

int getMemoryCacheThreshold()
                            throws java.lang.UnsupportedOperationException
Gets the size, in bytes, that the file upload must exceed before being cached to disk. Some implementations that support disk caching may not support the storing of small uploads in memory. Such implementations should ignore calls to this method and not throw an UnsupportedOperationException.

Returns:
bytes maximum size of the file upload before it will be cached to disk
Throws:
java.lang.UnsupportedOperationException - if this implementation does not support disk caching

getDiskCacheLocation

java.io.File getDiskCacheLocation()
                                  throws java.io.IOException,
                                         java.lang.UnsupportedOperationException
Gets the directory to be used for storing file uploads that exceed the memory cache threshold.

Returns:
location to store uploaded files
Throws:
java.io.IOException - if the directory does not exist or the File throws an IOException during this operation
java.lang.UnsupportedOperationException - if this implementation does not support disk caching

getFileUploadSizeLimit

int getFileUploadSizeLimit()
                           throws java.lang.UnsupportedOperationException
Gets the maximum size, in bytes, of file uploads to be accepted. Uploads that exceed the specified size are terminated or handled in a manner that minimizes the risk of a Denial of Service attack against the application.

Returns:
the size threshold after which a file upload is rejected
Throws:
java.lang.UnsupportedOperationException - if this implementation does not support limiting file upload sizes