org.apache.wicket.markup.html
Class WebResource

java.lang.Object
  extended by org.apache.wicket.Resource
      extended by org.apache.wicket.markup.html.WebResource
All Implemented Interfaces:
Serializable, IClusterable, IRequestListener, IResourceListener
Direct Known Subclasses:
ByteArrayResource, ContextRelativeResource, DynamicByteArrayResource, DynamicWebResource, PackageResource

public abstract class WebResource
extends Resource

Base class for web resources. See the base class Resource for details on resources in general, including how they can be shared in an application.

Author:
Jonathan Locke
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.wicket.IResourceListener
INTERFACE
 
Constructor Summary
WebResource()
          Construct.
 
Method Summary
protected  void configureResponse(Response response)
          Allows implementations to do configure the response, like setting headers etc.
protected  int getCacheDuration()
           
protected  void setHeaders(WebResponse response)
          Subclasses can override this to set there headers when the resource is being served.
 
Methods inherited from class org.apache.wicket.Resource
getParameters, getResourceStream, invalidate, isCacheable, onResourceRequested, setCacheable, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResource

public WebResource()
Construct.

Method Detail

configureResponse

protected final void configureResponse(Response response)
Description copied from class: Resource
Allows implementations to do configure the response, like setting headers etc.

Overrides:
configureResponse in class Resource
Parameters:
response - the response
See Also:
Resource.configureResponse(org.apache.wicket.Response)

setHeaders

protected void setHeaders(WebResponse response)
Subclasses can override this to set there headers when the resource is being served. By default 2 headers will be set if the Resource is cacheable
 response.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000));
 response.setHeader("Cache-Control", "max-age=" + 3600);
 
So if a resource wants to control this or doesn't want to set this info it should override this method and don't call super.

Parameters:
response - The WebResponse where set(Date)Header can be called on.

getCacheDuration

protected int getCacheDuration()
Returns:
The cache duration in seconds


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