public class GenericURLResolver extends Object implements IURLResolver
IURLResolver
.
The web resource's property
lumis.portal.url.IURLResolver.pattern
is used to customize the friendly path generated by this resolver.
The value of the property is a EL expression where the following variables
may be used:
wr
: the WebResource
instance.ancestralPath
: the friendly path of the nearest ancestral
web resource that has a friendly path value set. If no such web resource
exists, it is resolved to null
param
: Maps a request parameter name to a single value.paramValues
: Maps a request parameter name to an array of values.paramsPath
: an automatic generated path fragment containing
parameter names and values. The path starts with slash if it is non-empty,
otherwise it does not contain an starting slash. GUID format parameter values
and values for special parameters are ignored.currentPath
: the current path value in the pipeline.
Corresponds to the parameter given in
resolveFriendlyPath(WebResource, String)
.
The string evaluated from each EL code fragment will have the '/' character replaced by
getSlashReplacementString()
(current implementation returns "-", override to
customize it). If you override resolveVariable(String, WebResource, String)
to return a string, it may use encodeSlashes(String)
to prevent the slashes in
the returned value from being replaced. The variables ancestralPath
,
paramsPath
and currentPath
use encodeSlashes(String)
so the slash they generate are not replaced.
The resulting value is normalized by:
normalize(String)
.
It may be overridden to be customized.
The default pattern (used if the pattern property is not set) is:
${ancestralPath}/${wr.urlTitle}${paramsPath}
Constructor and Description |
---|
GenericURLResolver() |
Modifier and Type | Method and Description |
---|---|
protected String |
encodeSlashes(String value)
Encodes the given value, in a way to keep all existing slashes
so that they are not replaced into
getSlashReplacementString() . |
protected String |
getSlashReplacementString()
Returns the substituter string for slashes.
|
protected boolean |
isParameterVisible(String name,
String[] values)
Indicates if a parameter is to be shown in the string generated by
paramsPath . |
protected String |
normalize(String value)
Normalizes a string value to the form it should take in the friendly
path.
|
String |
resolveFriendlyPath(WebResource resource,
String currentPath)
Resolves the friendly path for a web resource.
|
protected Object |
resolveVariable(String variableName,
WebResource webResource,
String currentPath)
Resolves a variable in the friendly path expression.
|
public String resolveFriendlyPath(WebResource resource, String currentPath) throws PortalException
IURLResolver
resolveFriendlyPath
in interface IURLResolver
resource
- the web resource.currentPath
- the path value resolved by previous
IURLResolver
in the resolution pipeline, or an empty String
if this is the first resolver in the pipeline.PortalException
protected final String encodeSlashes(String value)
getSlashReplacementString()
.
This method is intended to be used in resolveVariable(String, WebResource, String)
when a string containing '/' is returned and is not desired for it to be replaced
by getSlashReplacementString()
.
value
- the value to be encoded.protected String getSlashReplacementString()
resolveFriendlyPath(WebResource, String)
.
By default the value returned is "-".protected Object resolveVariable(String variableName, WebResource webResource, String currentPath) throws ELException
The string evaluated from each EL code fragment will have the '/' character replaced by
getSlashReplacementString()
(default is '-'). If you override
resolveVariable(String, WebResource, String)
to return a string, it may use
encodeSlashes(String)
to prevent the slashes in the returned value from being replaced.
variableName
- the name of the variable to be resolved.webResource
- the web resource.currentPath
- the current path in the friendly path resolution.ELException
- if the variable could not be resolved.resolveFriendlyPath(WebResource, String)
,
encodeSlashes(String)
protected boolean isParameterVisible(String name, String[] values)
paramsPath
.name
- the parameter name.values
- the parameter values.true
if the parameter is to be shown,
false
otherwise.LumisXP 12.3.0.200408 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.