com.vaadin.flow.server.streams.
Record Class TransferContext
Record Components:
request
- The current Vaadin request instance
response
- The current Vaadin response instance
session
- The current Vaadin session instance
fileName
- The name of the file being transferred. Might be null
if the file name is not known.
owningElement
- The owner element that initiated the transfer. Can be used to get
element's attributes or properties.
contentLength
- the total number of bytes to be transferred or -1
if
total number is unknown in advance, e.g. when reading from an
input stream
A context that is given to all data transfer progress listeners. Holds the references that may be needed for UI updates in listeners, e.g. showing a data transfer progress or a notification.
-
Constructor Summary
ConstructorsConstructorDescriptionTransferContext
(VaadinRequest request, VaadinResponse response, VaadinSession session, String fileName, Element owningElement, long contentLength) Creates an instance of a
TransferContext
record class. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the value of the
contentLength
record component.final boolean
Indicates whether some other object is "equal to" this one.
fileName()
Returns the value of the
fileName
record component.Get owner
Component
for this data transfer.getUI()
Get the current UI instance for this data transfer that can be used to make asynchronnous UI updates with
UI.access(com.vaadin.flow.server.Command)
.final int
hashCode()
Returns a hash code value for this object.
Returns the value of the
owningElement
record component.request()
Returns the value of the
request
record component.response()
Returns the value of the
response
record component.session()
Returns the value of the
session
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
TransferContext
public TransferContext(VaadinRequest request, VaadinResponse response, VaadinSession session, String fileName, Element owningElement, long contentLength) Creates an instance of a
TransferContext
record class.Parameters:
request
- the value for therequest
record componentresponse
- the value for theresponse
record componentsession
- the value for thesession
record componentfileName
- the value for thefileName
record componentowningElement
- the value for theowningElement
record componentcontentLength
- the value for thecontentLength
record component
-
-
Method Details
-
getOwningComponent
Get owner
Component
for this data transfer.The progress listener may change the component's state during donwload, e.g. disable or hide it during transfer or get the component's own data like id.
Returns:
owning component or null if none is defined
-
getUI
Get the current UI instance for this data transfer that can be used to make asynchronnous UI updates with
UI.access(com.vaadin.flow.server.Command)
.Returns:
Current UI instance
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with
Objects::equals(Object,Object)
; primitive components are compared with '=='. -
request
Returns the value of the
request
record component.Returns:
the value of the
request
record component -
response
Returns the value of the
response
record component.Returns:
the value of the
response
record component -
session
Returns the value of the
session
record component.Returns:
the value of the
session
record component -
fileName
Returns the value of the
fileName
record component.Returns:
the value of the
fileName
record component -
owningElement
Returns the value of the
owningElement
record component.Returns:
the value of the
owningElement
record component -
contentLength
public long contentLength()Returns the value of the
contentLength
record component.Returns:
the value of the
contentLength
record component
-