public class BufferedDynamicImageResource extends DynamicImageResource
The format of the image (and therefore the resource's extension) can be specified with setFormat(String). The default format is "PNG" because JPEG is lossy and makes generated images look bad and GIF has patent issues.
RenderedDynamicImageResource
,
Serialized FormAbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
IResource.Attributes
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
Constructor and Description |
---|
BufferedDynamicImageResource()
Construct.
|
BufferedDynamicImageResource(String format)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getImageData(IResource.Attributes attributes)
Get image data for our dynamic image resource.
|
void |
setImage(BufferedImage image) |
configureResponse, getFormat, newResourceResponse, setFormat, setLastModifiedTime, toImageData
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public BufferedDynamicImageResource()
public BufferedDynamicImageResource(String format)
format
- public void setImage(BufferedImage image)
image
- The image to setprotected byte[] getImageData(IResource.Attributes attributes)
DynamicImageResource
DynamicImageResource.setLastModifiedTime(Time)
when it does so. This
ensures that image caching works correctly.getImageData
in class DynamicImageResource
attributes
- the context bringing the request, response and the parametersnull
means there is no image and 404
(Not found) response will be return.Copyright © 2006–2022 Apache Software Foundation. All rights reserved.