@Deprecated 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
VirtualURIMapping.MappingResult
fromURI, pattern, toURI
Constructor and Description |
---|
RotatingVirtualURIMapping()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isValid()
Deprecated.
Validate necessary info to check VirtualUriMapping is valid.
|
VirtualURIMapping.MappingResult |
mapURI(String uri)
Deprecated.
Maps an incoming URI to a new target URI.
|
void |
setEnd(int end)
Deprecated.
Sets the end.
|
void |
setPadding(int padding)
Deprecated.
Sets the padding.
|
void |
setStart(int start)
Deprecated.
Sets the start.
|
mapURI, setFromURI
getFromURI, getToURI, setToURI, toString
public void setStart(int start)
start
- the start to setpublic void setEnd(int end)
end
- the end to setpublic void setPadding(int padding)
padding
- the padding to setpublic VirtualURIMapping.MappingResult mapURI(String uri)
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.mapURI
in interface VirtualURIMapping
mapURI
in class RegexpVirtualURIMapping
uri
- the URI of the current request, decoded and without the context pathVirtualURIMapping.MappingResult
with the target URI and level or null if the mapping doesn't applypublic boolean isValid()
VirtualURIMapping
isValid
in interface VirtualURIMapping
isValid
in class RegexpVirtualURIMapping
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.