org.apache.wicket.request.resource
Class AbstractResource

java.lang.Object
  extended by org.apache.wicket.request.resource.AbstractResource
All Implemented Interfaces:
java.io.Serializable, IClusterable, IResource
Direct Known Subclasses:
ByteArrayResource, ContextRelativeResource, DynamicImageResource, MergedResourcesResource, PackageResource, ResourceStreamResource

public abstract class AbstractResource
extends java.lang.Object
implements IResource

Convenience resource implementation. The subclass must implement newResourceResponse(org.apache.wicket.request.resource.IResource.Attributes) method.

Author:
Matej Knopp
See Also:
Serialized Form

Nested Class Summary
static class AbstractResource.ResourceResponse
          Represents data used to configure response and write resource data.
static class AbstractResource.WriteCallback
          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
static java.util.Set<java.lang.String> INTERNAL_HEADERS
          header values that are managed internally and must not be set directly
 
Constructor Summary
AbstractResource()
          Construct.
 
Method Summary
protected  void configureCache(AbstractResource.ResourceResponse data, IResource.Attributes attributes)
          Configure the web response header for client cache control.
protected  IResourceCachingStrategy getCachingStrategy()
           
protected abstract  AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes)
          Override this method to return a AbstractResource.ResourceResponse for the request.
 void respond(IResource.Attributes attributes)
          Renders this resource to response using the provided attributes.
protected  void setResponseHeaders(AbstractResource.ResourceResponse data, IResource.Attributes attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL_HEADERS

public static final java.util.Set<java.lang.String> INTERNAL_HEADERS
header values that are managed internally and must not be set directly

Constructor Detail

AbstractResource

public AbstractResource()
Construct.

Method Detail

newResourceResponse

protected abstract AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes)
Override this method to return a AbstractResource.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 data
attributes - request attributes

getCachingStrategy

protected IResourceCachingStrategy getCachingStrategy()

respond

public final void respond(IResource.Attributes attributes)
Description copied from interface: IResource
Renders this resource to response using the provided attributes.

Specified by:
respond in interface IResource
See Also:
IResource.respond(org.apache.wicket.request.resource.IResource.Attributes)

setResponseHeaders

protected void setResponseHeaders(AbstractResource.ResourceResponse data,
                                  IResource.Attributes attributes)
Parameters:
data -
attributes -


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.