Package com.vaadin.flow.server
Class AbstractStreamResource
java.lang.Object
com.vaadin.flow.server.AbstractStreamResource
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StreamReceiver,StreamResource,StreamResourceRegistry.ElementStreamResource
Abstract stream resource class. Extending class may be used for data transfer
in either to the client (dynamic data) or from the client (file upload).
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGets the length of cache expiration time.getId()Gets unique identifier of the resource.abstract StringgetName()Get the resource name.setCacheTime(long cacheTime) Set cache time in millis.
-
Constructor Details
-
AbstractStreamResource
public AbstractStreamResource()
-
-
Method Details
-
getCacheTime
public long getCacheTime()Gets the length of cache expiration time. This gives the possibility to cache the resource. "Cache-Control" HTTP header will be set based on this value.Default value is
0. So caching is disabled.- Returns:
- cache time in milliseconds.
-
setCacheTime
Set cache time in millis. Zero or negative value disables the caching of this stream.- Parameters:
cacheTime- cache time- Returns:
- this resource
-
getId
Gets unique identifier of the resource.- Returns:
- the resource unique id
-
getName
Get the resource name.The value will be used in URI (generated when resource is registered) in a way that the
nameis the last segment of the path. So this is a synthetic name.- Returns:
- resource name
-