org.apache.wicket.core.request.mapper
Class ResourceMapper

java.lang.Object
  extended by org.apache.wicket.request.mapper.AbstractMapper
      extended by org.apache.wicket.core.request.mapper.ResourceMapper
All Implemented Interfaces:
IRequestMapper

public class ResourceMapper
extends AbstractMapper
implements IRequestMapper

A IRequestMapper to mount resources to a custom mount path

sample structure of url
    /myresources/${category}/images/[indexed-param-0]/[indexed-param-1]?[named-param-1=value]&[named-param-2=value2]
 

sample usage

in your wicket application's init() method use a statement like this

 mountResource("/images", new ImagesResourceReference()));
 
Note: Mounted this way the resource reference has application scope, i.e. it is shared between all users of the application. It is recommended to not keep any state in it.

Author:
Peter Ertl
See Also:
WebApplication.mountResource(String, org.apache.wicket.request.resource.ResourceReference)

Constructor Summary
ResourceMapper(String path, ResourceReference resourceReference)
          create a resource mapper for a resource
ResourceMapper(String path, ResourceReference resourceReference, IPageParametersEncoder encoder)
          create a resource mapper for a resource
 
Method Summary
protected  void addCachingDecoration(Url url, PageParameters parameters)
           
protected  IResourceCachingStrategy getCachingStrategy()
           
 int getCompatibilityScore(Request request)
           
 Url mapHandler(IRequestHandler requestHandler)
           
 IRequestHandler mapRequest(Request request)
           
protected  void removeCachingDecoration(Url url, PageParameters parameters)
           
 
Methods inherited from class org.apache.wicket.request.mapper.AbstractMapper
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, removeMetaParameter, urlStartsWith
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceMapper

public ResourceMapper(String path,
                      ResourceReference resourceReference)
create a resource mapper for a resource

Parameters:
path - mount path for the resource
resourceReference - resource reference that should be linked to the mount path
See Also:
ResourceMapper(String, org.apache.wicket.request.resource.ResourceReference, org.apache.wicket.request.mapper.parameter.IPageParametersEncoder)

ResourceMapper

public ResourceMapper(String path,
                      ResourceReference resourceReference,
                      IPageParametersEncoder encoder)
create a resource mapper for a resource

Parameters:
path - mount path for the resource
resourceReference - resource reference that should be linked to the mount path
encoder - encoder for url parameters
Method Detail

mapRequest

public IRequestHandler mapRequest(Request request)
Specified by:
mapRequest in interface IRequestMapper

getCompatibilityScore

public int getCompatibilityScore(Request request)
Specified by:
getCompatibilityScore in interface IRequestMapper

mapHandler

public Url mapHandler(IRequestHandler requestHandler)
Specified by:
mapHandler in interface IRequestMapper

getCachingStrategy

protected IResourceCachingStrategy getCachingStrategy()

addCachingDecoration

protected void addCachingDecoration(Url url,
                                    PageParameters parameters)

removeCachingDecoration

protected void removeCachingDecoration(Url url,
                                       PageParameters parameters)


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