Class PreviewImageProcessor


  • public class PreviewImageProcessor
    extends Object
    • Constructor Detail

      • PreviewImageProcessor

        public PreviewImageProcessor()
    • Method Detail

      • findImage

        public static byte[] findImage​(ImageRequestParameter params)
        Finds the appropriate preview image for the given image request parameters.
        Parameters:
        params - Parameters for the image request.
        Returns:
        The preview image for the given request parameters.
      • findImageIfChanged

        public static byte[] findImageIfChanged​(javax.servlet.http.HttpServletRequest req,
                                                javax.servlet.http.HttpServletResponse resp,
                                                ImageRequestParameter params)
        Finds the appropriate preview image for the given image request parameters.
        Parameters:
        params - Parameters for the image request.
        Returns:
        The preview image for the given request parameters. An empty byte array if the preview image is unchanged.
      • writeImage

        public static void writeImage​(javax.servlet.http.HttpServletResponse resp,
                                      ImageRequestParameter params,
                                      byte[] scrFile)
                               throws IOException
        Writes the given image to the response. Takes care of settings the appropriate content type. The format may be determined by the ImageRequestParameters.
        Parameters:
        resp - Response to write to.
        params - Parameters for the image request.
        scrFile - Source file with the image data.
        Throws:
        IOException - on errors while writing the image to re response
      • writeDefaultImage

        public static void writeDefaultImage​(javax.servlet.http.HttpServletResponse resp,
                                             ImageRequestParameter params)
                                      throws IOException
        Writes the default preview image to the response. Takes care of settings the appropriate content type. The format may be determined by the ImageRequestParameters.
        Parameters:
        resp - Response to write to.
        params - Parameters for the image request.
        Throws:
        IOException - on errors while writing the image to re response