Package de.xima.fc.form.image
Class PreviewImageProcessor
java.lang.Object
de.xima.fc.form.image.PreviewImageProcessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
findImage
(ImageRequestParameter params) Finds the appropriate preview image for the given image request parameters.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.static void
writeDefaultImage
(javax.servlet.http.HttpServletResponse resp, ImageRequestParameter params) Writes the default preview image to the response.static void
writeImage
(javax.servlet.http.HttpServletResponse resp, ImageRequestParameter params, byte[] scrFile) Writes the given image to the response.
-
Constructor Details
-
PreviewImageProcessor
public PreviewImageProcessor()
-
-
Method Details
-
findImage
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 theImageRequestParameter
s.- 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 theImageRequestParameter
s.- Parameters:
resp
- Response to write to.params
- Parameters for the image request.- Throws:
IOException
- on errors while writing the image to re response
-