org.apache.wicket.request.resource.caching
Class QueryStringWithVersionResourceCachingStrategy

java.lang.Object
  extended by org.apache.wicket.request.resource.caching.QueryStringWithVersionResourceCachingStrategy
All Implemented Interfaces:
IResourceCachingStrategy

public class QueryStringWithVersionResourceCachingStrategy
extends java.lang.Object
implements IResourceCachingStrategy

resource caching strategy that adds a version string to the query parameters of the resource (this is similar to how wicket 1.4 does it when enabling timestamps on resources). You should preferably use FilenameWithVersionResourceCachingStrategy since it is more reliable.

Since:
1.5
Author:
Peter Ertl
See Also:
FilenameWithVersionResourceCachingStrategy

Constructor Summary
QueryStringWithVersionResourceCachingStrategy(IResourceVersion resourceVersion)
          create query string resource caching strategy

it will use a query parameter named for storing the version information.

QueryStringWithVersionResourceCachingStrategy(java.lang.String versionParameter, IResourceVersion resourceVersion)
          create query string resource caching strategy

it will use a query parameter with name specified by parameter resourceVersion for storing the version information.

 
Method Summary
 void decorateResponse(AbstractResource.ResourceResponse response, IStaticCacheableResource resource)
          decorate resource response
 void decorateUrl(ResourceUrl url, IStaticCacheableResource resource)
          add caching related information to filename + parameters
 java.lang.String getVersionParameter()
           
 void undecorateUrl(ResourceUrl url)
          Removes caching related information from filename + parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryStringWithVersionResourceCachingStrategy

public QueryStringWithVersionResourceCachingStrategy(IResourceVersion resourceVersion)
create query string resource caching strategy

it will use a query parameter named for storing the version information.

Parameters:
resourceVersion - resource version provider

QueryStringWithVersionResourceCachingStrategy

public QueryStringWithVersionResourceCachingStrategy(java.lang.String versionParameter,
                                                     IResourceVersion resourceVersion)
create query string resource caching strategy

it will use a query parameter with name specified by parameter resourceVersion for storing the version information.

Parameters:
versionParameter - name of version parameter which will be added to query string containing the resource version
resourceVersion - resource version provider
Method Detail

getVersionParameter

public final java.lang.String getVersionParameter()
Returns:
name of version parameter which will be added to query string

decorateUrl

public void decorateUrl(ResourceUrl url,
                        IStaticCacheableResource resource)
Description copied from interface: IResourceCachingStrategy
add caching related information to filename + parameters

Specified by:
decorateUrl in interface IResourceCachingStrategy
Parameters:
url - parameters to which caching information should be added and which will be used to construct the url to the resource
resource - cacheable resource

undecorateUrl

public void undecorateUrl(ResourceUrl url)
Description copied from interface: IResourceCachingStrategy
Removes caching related information from filename + parameters. In essenese this method undoes what IResourceCachingStrategy.decorateUrl(ResourceUrl, IStaticCacheableResource) did.

Specified by:
undecorateUrl in interface IResourceCachingStrategy
Parameters:
url - parameters that were used to construct the url to the resource and from which previously added caching information should be stripped

decorateResponse

public void decorateResponse(AbstractResource.ResourceResponse response,
                             IStaticCacheableResource resource)
Description copied from interface: IResourceCachingStrategy
decorate resource response

Specified by:
decorateResponse in interface IResourceCachingStrategy


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