Class DynamicImageResource

    • Constructor Detail

      • DynamicImageResource

        public DynamicImageResource()
        Construct.
      • DynamicImageResource

        public DynamicImageResource​(String format)
        Creates a dynamic resource from for the given locale
        Parameters:
        format - The image format ("png", "jpeg", etc)
    • Method Detail

      • getFormat

        public final String getFormat()
        Returns:
        Returns the image format.
      • setFormat

        public final void setFormat​(String format)
        Sets the format of this resource
        Parameters:
        format - The format (jpg, png or gif..)
      • setLastModifiedTime

        protected void setLastModifiedTime​(Instant time)
        set the last modified time for this resource.
        Parameters:
        time -
      • toImageData

        protected byte[] toImageData​(BufferedImage image)
        Parameters:
        image - The image to turn into data
        Returns:
        The image data for this dynamic image
      • getImageData

        protected abstract byte[] getImageData​(IResource.Attributes attributes)
        Get image data for our dynamic image resource. If the subclass regenerates the data, it should set the DynamicImageResource#setLastModifiedTime(Time) when it does so. This ensures that image caching works correctly.
        Parameters:
        attributes - the context bringing the request, response and the parameters
        Returns:
        The image data for this dynamic image. null means there is no image and 404 (Not found) response will be return.