Package com.vaadin.flow.internal.streams
Class ActiveTransfer
java.lang.Object
com.vaadin.flow.internal.streams.ActiveTransfer
- All Implemented Interfaces:
Serializable
An upload or download request that is currently being served for a UI.
The UI that an active transfer belongs to is kept attached to its session even if the UI is closed, so that listeners and callbacks bound to that UI are still effective while the transfer is ongoing. A transfer is terminated when the session is invalidated, which makes the streams that the framework has handed out to the request handler refuse to transfer any more bytes.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionActiveTransfer(String path, Element owner) Creates a record for a transfer that is served from the given path for the given owner element. -
Method Summary
Modifier and TypeMethodDescriptionDescribes this transfer for logging purposes.booleanChecks whether this transfer has been terminated.voidTerminates this transfer, which makes the streams handed out for it stop transferring bytes.wrapRequest(VaadinRequest request) Returns the given request with any stream that it hands out replaced by one that stops transferring bytes once this transfer is terminated.wrapResponse(VaadinResponse response) Returns the given response with any stream that it hands out replaced by one that stops transferring bytes once this transfer is terminated.
-
Constructor Details
-
ActiveTransfer
Creates a record for a transfer that is served from the given path for the given owner element.- Parameters:
path- the path of the request being served, used for loggingowner- the element that owns the request handler, used for logging, notnull
-
-
Method Details
-
terminate
public void terminate()Terminates this transfer, which makes the streams handed out for it stop transferring bytes. -
isTerminated
public boolean isTerminated()Checks whether this transfer has been terminated.- Returns:
trueif the transfer has been terminated,falseotherwise
-
wrapRequest
Returns the given request with any stream that it hands out replaced by one that stops transferring bytes once this transfer is terminated.A request implementation that the framework doesn't know how to wrap is returned as-is.
- Parameters:
request- the request to wrap, notnull- Returns:
- the wrapped request
-
wrapResponse
Returns the given response with any stream that it hands out replaced by one that stops transferring bytes once this transfer is terminated.A response implementation that the framework doesn't know how to wrap is returned as-is.
- Parameters:
response- the response to wrap, notnull- Returns:
- the wrapped response
-
getDescription
Describes this transfer for logging purposes.- Returns:
- a description of this transfer
-