Module org.apache.wicket.core
Class BlobImageResource
java.lang.Object
org.apache.wicket.request.resource.AbstractResource
org.apache.wicket.request.resource.DynamicImageResource
org.apache.wicket.markup.html.image.resource.BlobImageResource
- All Implemented Interfaces:
Serializable
,IResource
,IClusterable
An ImageResource subclass for dynamic images that come from database BLOB fields. Subclasses
override getBlob() to provide the image data to send back to the user. A given subclass may
decide how to produce this data and whether/how to buffer it.
- Author:
- Eelco Hillenius
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.AbstractResource
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource
IResource.Attributes
-
Field Summary
Fields inherited from class org.apache.wicket.request.resource.AbstractResource
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Blob
getBlob
(IResource.Attributes attributes) Gets the BLOB (Binary Large OBject) that holds the raw image data.protected byte[]
getImageData
(IResource.Attributes attributes) Get image data for our dynamic image resource.Methods inherited from class org.apache.wicket.request.resource.DynamicImageResource
configureResponse, getFormat, newResourceResponse, setFormat, setLastModifiedTime, toImageData
Methods inherited from class org.apache.wicket.request.resource.AbstractResource
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
-
Constructor Details
-
BlobImageResource
Construct.- Parameters:
format
-
-
BlobImageResource
public BlobImageResource()Construct.
-
-
Method Details
-
getImageData
Description copied from class:DynamicImageResource
Get image data for our dynamic image resource. If the subclass regenerates the data, it should set theDynamicImageResource.setLastModifiedTime(Instant)
when it does so. This ensures that image caching works correctly.- Specified by:
getImageData
in classDynamicImageResource
- Parameters:
attributes
- the context bringing the request, response and the parameters- Returns:
- The image data for this dynamic image.
null
means there is no image and 404 (Not found) response will be return.
-
getBlob
Gets the BLOB (Binary Large OBject) that holds the raw image data.- Parameters:
attributes
- the current web attributes (request, response, parameters)- Returns:
- the BLOB
-