public interface ImageServletResponse
extends javax.servlet.ServletResponse
getImage()
to have any effect.Modifier and Type | Field and Description |
---|---|
static String |
ATTRIB_AOI
Request attribute of type
Rectangle controlling image
source region (area of interest). |
static String |
ATTRIB_AOI_PERCENT
Request attribute of type
Boolean controlling image AOI. |
static String |
ATTRIB_AOI_UNIFORM
Request attribute of type
Boolean controlling image AOI. |
static String |
ATTRIB_BG_COLOR
Request attribute of type
Color controlling background
color for any transparent/translucent areas of the image. |
static String |
ATTRIB_IMAGE_RESAMPLE_ALGORITHM
Request attribute of type
Integer controlling image resample
algorithm. |
static String |
ATTRIB_OUTPUT_QUALITY
Request attribute of type
Float controlling image output compression/quality. |
static String |
ATTRIB_READ_SUBSAMPLING_FACTOR
Request attribute of type
Double controlling image read
subsampling factor. |
static String |
ATTRIB_SIZE
Request attribute of type
Dimension controlling image
size. |
static String |
ATTRIB_SIZE_PERCENT
Request attribute of type
Boolean controlling image sizing. |
static String |
ATTRIB_SIZE_UNIFORM
Request attribute of type
Boolean controlling image sizing. |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Writes the image to the original
ServletOutputStream . |
BufferedImage |
getImage()
Gets the decoded image from the response.
|
String |
getOutputContentType()
Gets the image format for this response, such as "image/gif" or "image/jpeg".
|
void |
setImage(RenderedImage pImage)
Sets the image for this response.
|
void |
setOutputContentType(String pImageFormat)
Sets the image format for this response, such as "image/gif" or "image/jpeg".
|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocale
static final String ATTRIB_SIZE
Dimension
controlling image
size.
If either width
or height
is negative, the size is
computed, using uniform scaling.
Else, if SIZE_UNIFORM
is true
, the size will be
computed to the largest possible area (with correct aspect ratio)
fitting inside the target area.
Otherwise, the image is scaled to the given size, with no regard to
aspect ratio.
Defaults to null
(original image size).static final String ATTRIB_SIZE_UNIFORM
Boolean
controlling image sizing.
Defaults to Boolean.TRUE
.static final String ATTRIB_SIZE_PERCENT
Boolean
controlling image sizing.
Defaults to Boolean.FALSE
.static final String ATTRIB_AOI
Rectangle
controlling image
source region (area of interest).
Defaults to null
(the entire image).static final String ATTRIB_AOI_UNIFORM
Boolean
controlling image AOI.
Defaults to Boolean.FALSE
.static final String ATTRIB_AOI_PERCENT
Boolean
controlling image AOI.
Defaults to Boolean.FALSE
.static final String ATTRIB_BG_COLOR
Color
controlling background
color for any transparent/translucent areas of the image.
Defaults to null
(keeps the transparent areas transparent).static final String ATTRIB_OUTPUT_QUALITY
Float
controlling image output compression/quality.
Used for formats that accepts compression or quality settings,
like JPEG (quality), PNG (compression only) etc.
Defaults to 0.8f
for JPEG.static final String ATTRIB_READ_SUBSAMPLING_FACTOR
Double
controlling image read
subsampling factor. Controls the maximum sample pixels in each direction,
that is read per pixel in the output image, if the result will be
downscaled.
Larger values will result in better quality, at the expense of higher
memory consumption and CPU usage.
However, using values above 3.0
will usually not improve image
quality.
Legal values are in the range [1.0 .. positive infinity>
.
Defaults to 2.0
.static final String ATTRIB_IMAGE_RESAMPLE_ALGORITHM
Integer
controlling image resample
algorithm.
Legal values are SCALE_DEFAULT
,
SCALE_FAST
or
SCALE_SMOOTH
.
Note: When using a value of SCALE_FAST
, you should also use a
subsampling factor of 1.0
, for fast read/scale.
Otherwise, use a subsampling factor of 2.0
for better quality.
Defaults to SCALE_DEFAULT
.String getOutputContentType()
setOutputContentType(String)
void setOutputContentType(String pImageFormat)
pImageFormat
- the image format for this response.void flush() throws IOException
ServletOutputStream
.
If no format is set in this response,
the image is encoded in the same format as the original image.IOException
- if an I/O exception occurs during writingBufferedImage getImage() throws IOException
BufferedImage
or null
if the image could not be read.IOException
- if an I/O exception occurs during readingvoid setImage(RenderedImage pImage)
pImage
- the new response image.Copyright © 2017. All rights reserved.