public class StreamReceiverHandler extends Object implements Serializable
StreamResource
instances registered in VaadinSession
.Modifier and Type | Class and Description |
---|---|
static class |
StreamReceiverHandler.UploadInterruptedException
An UploadInterruptedException will be thrown by an ongoing upload if
StreamVariable.isInterrupted() returns true . |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS |
Constructor and Description |
---|
StreamReceiverHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
doHandleMultipartFileUpload(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamReceiver streamReceiver,
StateNode owner)
Method used to stream content from a multipart request to given
StreamVariable.
|
protected void |
doHandleXhrFilePost(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamReceiver streamReceiver,
StateNode 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.
|
void |
handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamReceiver streamReceiver,
String uiId,
String securityKey)
Handle reception of incoming stream from the client.
|
public static final int DEFAULT_STREAMING_PROGRESS_EVENT_INTERVAL_MS
public void handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response, StreamReceiver streamReceiver, String uiId, String securityKey) throws IOException
session
- The session for the requestrequest
- The request to handleresponse
- The response object to which a response can be written.streamReceiver
- the receiver containing the destination stream variableuiId
- id of the targeted uisecurityKey
- security from the request that should match registered stream
receiver idIOException
- if an IO error occurredprotected void doHandleMultipartFileUpload(VaadinSession session, VaadinRequest request, VaadinResponse response, StreamReceiver streamReceiver, StateNode owner) throws 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 responsestreamReceiver
- the receiver containing the destination stream variableowner
- The owner of the streamIOException
- If there is a problem reading the request or writing the
responseprotected void doHandleXhrFilePost(VaadinSession session, VaadinRequest request, VaadinResponse response, StreamReceiver streamReceiver, StateNode owner, long contentLength) throws 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 responsestreamReceiver
- the receiver containing the destination stream variableowner
- The owner of the streamcontentLength
- The length of the request contentIOException
- If there is a problem reading the request or writing the
responseprotected int getProgressEventInterval()
Copyright © 2018. All rights reserved.