public abstract class DynamicImageResource extends AbstractResource
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
IResource.Attributes
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
Constructor and Description |
---|
DynamicImageResource()
Construct.
|
DynamicImageResource(String format)
Creates a dynamic resource from for the given locale
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureResponse(AbstractResource.ResourceResponse response,
IResource.Attributes attributes) |
String |
getFormat() |
protected abstract byte[] |
getImageData(IResource.Attributes attributes)
Get image data for our dynamic image resource.
|
protected AbstractResource.ResourceResponse |
newResourceResponse(IResource.Attributes attributes)
Override this method to return a
AbstractResource.ResourceResponse for the request. |
void |
setFormat(String format)
Sets the format of this resource
|
protected void |
setLastModifiedTime(Time time)
set the last modified time for this resource.
|
protected byte[] |
toImageData(BufferedImage image) |
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public DynamicImageResource()
public DynamicImageResource(String format)
format
- The image format ("png", "jpeg", etc)public final String getFormat()
public final void setFormat(String format)
format
- The format (jpg, png or gif..)protected void setLastModifiedTime(Time time)
time
- protected byte[] toImageData(BufferedImage image)
image
- The image to turn into dataprotected abstract byte[] getImageData(IResource.Attributes attributes)
setLastModifiedTime(Time)
when it does so. This
ensures that image caching works correctly.attributes
- the context bringing the request, response and the parametersnull
means there is no image and 404
(Not found) response will be return.protected void configureResponse(AbstractResource.ResourceResponse response, IResource.Attributes attributes)
protected AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes)
AbstractResource
AbstractResource.ResourceResponse
for the request.newResourceResponse
in class AbstractResource
attributes
- request attributesCopyright © 2006–2022 Apache Software Foundation. All rights reserved.