org.codehaus.enunciate.modules.rest
Class StreamingMultipartRequestHandler

java.lang.Object
  extended by org.codehaus.enunciate.modules.rest.StreamingMultipartRequestHandler
All Implemented Interfaces:
MultipartRequestHandler

public class StreamingMultipartRequestHandler
extends Object
implements MultipartRequestHandler

Multipart request handler that provides for a streaming approach for resolving the parts of the request.

Using the StreamingMultipartRequestHandler allows you to have access to the parts before they're completely uploaded, but the parsed parts are subject to the following restrictions:

Author:
Ryan Heaton

Constructor Summary
StreamingMultipartRequestHandler()
           
 
Method Summary
 MultipartProgressListenerFactory getProgressListenerFactory()
          A progress listener for the file upload.
 javax.servlet.http.HttpServletRequest handleMultipartRequest(javax.servlet.http.HttpServletRequest request)
          No-op, returns the request unmodified.
 boolean isMultipart(javax.servlet.http.HttpServletRequest request)
          Whether the request is a multipart request, according to commons-fileupload.
 Collection<javax.activation.DataHandler> parseParts(javax.servlet.http.HttpServletRequest request)
          Parses the parts.
 void setProgressListenerFactory(MultipartProgressListenerFactory progressListenerFactory)
          A progress listener for the file upload.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingMultipartRequestHandler

public StreamingMultipartRequestHandler()
Method Detail

isMultipart

public boolean isMultipart(javax.servlet.http.HttpServletRequest request)
Whether the request is a multipart request, according to commons-fileupload.

Specified by:
isMultipart in interface MultipartRequestHandler
Parameters:
request - The request.
Returns:
Whether the request is a multipart request.

handleMultipartRequest

public javax.servlet.http.HttpServletRequest handleMultipartRequest(javax.servlet.http.HttpServletRequest request)
No-op, returns the request unmodified.

Specified by:
handleMultipartRequest in interface MultipartRequestHandler
Parameters:
request - The request.
Returns:
The request (unmodified).

parseParts

public Collection<javax.activation.DataHandler> parseParts(javax.servlet.http.HttpServletRequest request)
                                                    throws IOException,
                                                           FileUploadException
Parses the parts. The resulting collection has an undefined size. Any attempts to access the size of the collection (including toArray()) will result in an UnsupportedOperationException.

The DataHandler instances each will have a DataSource that is an instance of StreamingFileItemDataSource

Specified by:
parseParts in interface MultipartRequestHandler
Parameters:
request - The request.
Returns:
The parts.
Throws:
IOException
FileUploadException

getProgressListenerFactory

public MultipartProgressListenerFactory getProgressListenerFactory()
A progress listener for the file upload.

Returns:
A progress listener for the file upload.

setProgressListenerFactory

public void setProgressListenerFactory(MultipartProgressListenerFactory progressListenerFactory)
A progress listener for the file upload.

Parameters:
progressListenerFactory - A progress listener for the file upload.