|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.communication.FileUploadHandler
public class FileUploadHandler
Handles a file upload request submitted via an Upload component.
Nested Class Summary | |
---|---|
static class |
FileUploadHandler.SimpleMultiPartInputStream
Stream that extracts content from another stream until the boundary string is encountered. |
static class |
FileUploadHandler.UploadInterruptedException
An UploadInterruptedException will be thrown by an ongoing upload if StreamVariable.isInterrupted() returns true . |
Field Summary | |
---|---|
static int |
DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS
|
Constructor Summary | |
---|---|
FileUploadHandler()
|
Method Summary | |
---|---|
protected void |
doHandleSimpleMultipartFileUpload(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamVariable streamVariable,
java.lang.String variableName,
ClientConnector owner,
java.lang.String boundary)
Method used to stream content from a multipart request (either from servlet or portlet request) to given StreamVariable. |
protected void |
doHandleXhrFilePost(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamVariable streamVariable,
java.lang.String variableName,
ClientConnector owner,
long contentLength)
Used to stream plain file post (aka XHR2.post(File)) |
protected int |
getProgressEventInterval()
To prevent event storming, streaming progress events are sent in this interval rather than every time the buffer is filled. |
boolean |
handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
Called when a request needs to be handled. |
protected void |
sendUploadResponse(VaadinRequest request,
VaadinResponse response)
TODO document |
protected boolean |
streamToReceiver(VaadinSession session,
java.io.InputStream in,
StreamVariable streamVariable,
java.lang.String filename,
java.lang.String type,
long contentLength)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS
Constructor Detail |
---|
public FileUploadHandler()
Method Detail |
---|
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws java.io.IOException
RequestHandler
true
to indicate that no more request
handlers should be invoked for the request.
Note that request handlers by default do not lock the session. If you are
using VaadinSession or anything inside the VaadinSession you must ensure
the session is locked. This can be done by extending
SynchronizedRequestHandler
or by using
VaadinSession.accessSynchronously(Runnable)
or
UI.accessSynchronously(Runnable)
.
handleRequest
in interface RequestHandler
session
- The session for the requestrequest
- The request to handleresponse
- The response object to which a response can be written.
java.io.IOException
- If an IO error occurredprotected void doHandleSimpleMultipartFileUpload(VaadinSession session, VaadinRequest request, VaadinResponse response, StreamVariable streamVariable, java.lang.String variableName, ClientConnector owner, java.lang.String boundary) throws java.io.IOException
This method takes care of locking the session as needed and does not assume the caller has locked the session. This allows the session to be locked only when needed and not when handling the upload data.
session
- The session containing the stream variablerequest
- The upload requestresponse
- The upload responsestreamVariable
- The destination stream variablevariableName
- The name of the destination stream variableowner
- The owner of the stream variableboundary
- The mime boundary used in the upload request
java.io.IOException
- If there is a problem reading the request or writing the
responseprotected void doHandleXhrFilePost(VaadinSession session, VaadinRequest request, VaadinResponse response, StreamVariable streamVariable, java.lang.String variableName, ClientConnector owner, long contentLength) throws java.io.IOException
This method takes care of locking the session as needed and does not assume the caller has locked the session. This allows the session to be locked only when needed and not when handling the upload data.
session
- The session containing the stream variablerequest
- The upload requestresponse
- The upload responsestreamVariable
- The destination stream variablevariableName
- The name of the destination stream variableowner
- The owner of the stream variablecontentLength
- The length of the request content
java.io.IOException
- If there is a problem reading the request or writing the
responseprotected final boolean streamToReceiver(VaadinSession session, java.io.InputStream in, StreamVariable streamVariable, java.lang.String filename, java.lang.String type, long contentLength) throws UploadException
in
- streamVariable
- filename
- type
- contentLength
-
UploadException
protected int getProgressEventInterval()
protected void sendUploadResponse(VaadinRequest request, VaadinResponse response) throws java.io.IOException
request
- response
-
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |