Class AbstractStreamResource

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    StreamReceiver, StreamResource

    public abstract class AbstractStreamResource
    extends Object
    implements Serializable
    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:
    Serialized Form
    • Constructor Detail

      • AbstractStreamResource

        public AbstractStreamResource()
    • Method Detail

      • 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

        public AbstractStreamResource setCacheTime​(long cacheTime)
        Set cache time in millis. Zero or negative value disables the caching of this stream.
        Parameters:
        cacheTime - cache time
        Returns:
        this resource
      • getId

        public String getId()
        Gets unique identifier of the resource.
        Returns:
        the resource unique id
      • getName

        public abstract String getName()
        Get the resource name.

        The value will be used in URI (generated when resource is registered) in a way that the name is the last segment of the path. So this is a synthetic name.

        Returns:
        resource name