java.lang.Object
org.apache.wicket.request.resource.AbstractResource
- All Implemented Interfaces:
Serializable
,IResource
,IClusterable
- Direct Known Subclasses:
BaseDataResource
,ConcatBundleResource
,ContextRelativeResource
,DynamicImageResource
,FileSystemResource
,PackageResource
,ResourceStreamResource
Convenience resource implementation. The subclass must implement
newResourceResponse(org.apache.wicket.request.resource.IResource.Attributes)
method.- Author:
- Matej Knopp, Tobias Soloschenko
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
All available content range types.static class
Represents data used to configure response and write resource data.static class
Callback invoked when resource data needs to be written to response.Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource
IResource.Attributes
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final MetaDataKey<Long>
The meta data key of the content range end bytestatic final MetaDataKey<Long>
The meta data key of the content range start byteheader values that are managed internally and must not be set directly -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureCache
(AbstractResource.ResourceResponse data, IResource.Attributes attributes) Configure the web response header for client cache control.protected IResourceCachingStrategy
protected abstract AbstractResource.ResourceResponse
newResourceResponse
(IResource.Attributes attributes) Override this method to return aAbstractResource.ResourceResponse
for the request.void
respond
(IResource.Attributes attributes) Renders this resource to response using the provided attributes.protected void
setRequestMetaData
(IResource.Attributes attributes) Reads the plain request header information and applies enriched information as meta data to the current request.protected void
setRequestRangeMetaData
(WebRequest webRequest) protected boolean
setResponseContentRangeHeaderFields
(WebResponse webResponse, IResource.Attributes attributes, long contentLength) Sets the content range header fields to the given web responseprotected void
setResponseHeaders
(AbstractResource.ResourceResponse resourceResponse, IResource.Attributes attributes) Sets the response header of resource response to the response received from the attributes
-
Field Details
-
INTERNAL_HEADERS
header values that are managed internally and must not be set directly -
CONTENT_RANGE_STARTBYTE
The meta data key of the content range start byte -
CONTENT_RANGE_ENDBYTE
The meta data key of the content range end byte -
CONTENT_DISPOSITION_HEADER_NAME
- See Also:
-
-
Constructor Details
-
AbstractResource
public AbstractResource()Construct.
-
-
Method Details
-
newResourceResponse
protected abstract AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes) Override this method to return aAbstractResource.ResourceResponse
for the request.- Parameters:
attributes
- request attributes- Returns:
- resource data instance
-
configureCache
protected void configureCache(AbstractResource.ResourceResponse data, IResource.Attributes attributes) Configure the web response header for client cache control.- Parameters:
data
- resource dataattributes
- request attributes
-
getCachingStrategy
-
respond
Description copied from interface:IResource
Renders this resource to response using the provided attributes. -
setRequestMetaData
Reads the plain request header information and applies enriched information as meta data to the current request. Those information are available for the whole request cycle.- Parameters:
attributes
- the attributes to get the plain request header information
-
setRequestRangeMetaData
-
setResponseHeaders
protected void setResponseHeaders(AbstractResource.ResourceResponse resourceResponse, IResource.Attributes attributes) Sets the response header of resource response to the response received from the attributes- Parameters:
resourceResponse
- the resource response to get the header fields fromattributes
- the attributes to get the response from to which the header information are going to be applied
-
setResponseContentRangeHeaderFields
protected boolean setResponseContentRangeHeaderFields(WebResponse webResponse, IResource.Attributes attributes, long contentLength) Sets the content range header fields to the given web response- Parameters:
webResponse
- the web response to apply the content range information toattributes
- the attributes to get the request fromcontentLength
- the content length of the response- Returns:
- if the content range header information has been applied
-