info.magnolia.cms.beans.config
Class RegexpVirtualURIMapping

java.lang.Object
  extended by info.magnolia.cms.beans.config.DefaultVirtualURIMapping
      extended by info.magnolia.cms.beans.config.RegexpVirtualURIMapping
All Implemented Interfaces:
QueryAwareVirtualURIMapping, VirtualURIMapping
Direct Known Subclasses:
RotatingVirtualURIMapping

public class RegexpVirtualURIMapping
extends DefaultVirtualURIMapping
implements QueryAwareVirtualURIMapping

Query aware virtual uri mapping implementation that uses regular expressions in fromURI/toURI. When using regular expression in fromURI, toURI can contain references to the regexp matches. For example:

 fromURI=/products/([0-9A-Z]+)\.html\?available(true|false)
 toURI=/product/detail.html?productId=$1&available=$2
 

Version:
$Id: DefaultVirtualURIMapping.java 10295 2007-08-02 21:33:58Z fgiust $
Author:
Fabrizio Giustina, philipp

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.cms.beans.config.VirtualURIMapping
VirtualURIMapping.MappingResult
 
Field Summary
 
Fields inherited from class info.magnolia.cms.beans.config.DefaultVirtualURIMapping
fromURI, pattern, toURI
 
Constructor Summary
RegexpVirtualURIMapping()
           
 
Method Summary
 VirtualURIMapping.MappingResult mapURI(String uri)
          Maps an incoming URI to a new target URI.
 VirtualURIMapping.MappingResult mapURI(String uri, String queryString)
          Maps an incoming URI and queryString to a new target URI.
 void setFromURI(String fromURI)
           
 
Methods inherited from class info.magnolia.cms.beans.config.DefaultVirtualURIMapping
getFromURI, getToURI, setToURI, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegexpVirtualURIMapping

public RegexpVirtualURIMapping()
Method Detail

mapURI

public VirtualURIMapping.MappingResult mapURI(String uri)
Description copied from interface: VirtualURIMapping
Maps an incoming URI to a new target URI. Returns a VirtualURIMapping.MappingResult describing the new URI and the level of match. The new URI can be prefixed with "redirect:", "permanent:" or "forward:" to trigger either a temporary redirect, a permanent redirect or a forward respectively. For redirects the URI can be absolute or relative within the web application (the context path is added automatically). If the mapping does not apply to the input URI this method returns null.

Specified by:
mapURI in interface VirtualURIMapping
Overrides:
mapURI in class DefaultVirtualURIMapping
Parameters:
uri - the URI of the current request, decoded and without the context path
Returns:
a VirtualURIMapping.MappingResult with the target URI and level or null if the mapping doesn't apply

mapURI

public VirtualURIMapping.MappingResult mapURI(String uri,
                                              String queryString)
Description copied from interface: QueryAwareVirtualURIMapping
Maps an incoming URI and queryString to a new target URI. Returns a VirtualURIMapping.MappingResult describing the new URI and the level of match. The new URI can be prefixed with "redirect:", "permanent:" or "forward:" to trigger either a temporary redirect, a permanent redirect or a forward respectively. For redirects the URI can be absolute or relative within the web application (the context path is added automatically). If the mapping does not apply to the input URI this method returns null.

Specified by:
mapURI in interface QueryAwareVirtualURIMapping
Parameters:
uri - the URI of the current request, decoded and without the context path
queryString - the Query String of the current request
Returns:
a VirtualURIMapping.MappingResult with the target URI and level or null if the mapping doesn't apply

setFromURI

public void setFromURI(String fromURI)
Overrides:
setFromURI in class DefaultVirtualURIMapping


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.