public class StreamReceiverHandler extends Object implements Serializable
StreamReceiver
instances registered in VaadinSession
.
For internal use only. May be renamed or removed in a future release.
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)
Streams 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 long |
getContentLength(VaadinRequest request)
Deprecated.
use
VaadinRequest.getContentLengthLong() instead |
protected org.apache.commons.fileupload.FileItemIterator |
getItemIterator(VaadinRequest request) |
protected Collection<javax.servlet.http.Part> |
getParts(VaadinRequest request) |
protected int |
getProgressEventInterval()
To prevent event storming, streaming progress events are sent in this
interval rather than every time the buffer is filled.
|
protected boolean |
handleFileUploadValidationAndData(VaadinSession session,
InputStream inputStream,
StreamReceiver streamReceiver,
String filename,
String mimeType,
long contentLength,
StateNode node) |
void |
handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
StreamReceiver streamReceiver,
String uiId,
String securityKey)
Handle reception of incoming stream from the client.
|
protected boolean |
isMultipartUpload(VaadinRequest request) |
void |
setFileCountMax(long fileCountMax) |
void |
setFileSizeMax(long fileSizeMax) |
void |
setRequestSizeMax(long requestSizeMax) |
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 boolean handleFileUploadValidationAndData(VaadinSession session, InputStream inputStream, StreamReceiver streamReceiver, String filename, String mimeType, long contentLength, StateNode node) throws UploadException
UploadException
protected int getProgressEventInterval()
@Deprecated protected long getContentLength(VaadinRequest request)
VaadinRequest.getContentLengthLong()
insteadprotected boolean isMultipartUpload(VaadinRequest request)
protected Collection<javax.servlet.http.Part> getParts(VaadinRequest request) throws Exception
Exception
protected org.apache.commons.fileupload.FileItemIterator getItemIterator(VaadinRequest request) throws org.apache.commons.fileupload.FileUploadException, IOException
org.apache.commons.fileupload.FileUploadException
IOException
public void setRequestSizeMax(long requestSizeMax)
public void setFileSizeMax(long fileSizeMax)
public void setFileCountMax(long fileCountMax)
Copyright © 2000–2023 Vaadin Ltd. All rights reserved.