info.magnolia.cms.beans.config
Class RotatingVirtualURIMapping
java.lang.Object
info.magnolia.cms.beans.config.DefaultVirtualURIMapping
info.magnolia.cms.beans.config.RegexpVirtualURIMapping
info.magnolia.cms.beans.config.RotatingVirtualURIMapping
- All Implemented Interfaces:
- QueryAwareVirtualURIMapping, VirtualURIMapping
public class RotatingVirtualURIMapping
- extends RegexpVirtualURIMapping
An extension of RegexpVirtualURIMapping
that allows a rotation between different destination urls. In order
to rotate toURI
must contain the *
that will be replaced by a random number between
start
(default is 1
) and end
(defaults is 3
).
An additional property padding
can specify the left 0 padding for numbers (defaults is 2
).
So for example a destination url like forward:/banner/image_*.jpg
will randomly forward the request to
/banner/image_01.jpg
, /banner/image_02.jpg
or /banner/image_03.jpg
- Version:
- $Id$
- Author:
- Fabrizio Giustina
RotatingVirtualURIMapping
public RotatingVirtualURIMapping()
setStart
public void setStart(int start)
- Sets the start.
- Parameters:
start
- the start to set
setEnd
public void setEnd(int end)
- Sets the end.
- Parameters:
end
- the end to set
setPadding
public void setPadding(int padding)
- Sets the padding.
- Parameters:
padding
- the padding to set
mapURI
public VirtualURIMapping.MappingResult mapURI(String uri)
- 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 RegexpVirtualURIMapping
- 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
Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.