Class Mapping
java.lang.Object
org.apache.sling.resourceresolver.impl.mapping.Mapping
The
Mapping
class conveys the mapping configuration used by the
ResourceResolverFactoryImpl
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
defines the 'both' directionstatic final Mapping
Simple mapper instance mapping path to URLs 1:1 in both directionsstatic final int
defines the 'inbound' direction, that is mapping request path to item pathstatic final int
defined the 'outbound' direction, that is mapping item path to URL path -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFrom()
getTo()
Replaces the prefix from by the new prefix to, if and only ifhandle
starts with the from prefix.boolean
Checks, if this mapping is defined for inbound mapping.boolean
Checks, if this mapping is defined for outbound mapping.Replaces the prefix to by the new prefix from, if and only ifuriPath
starts with the to prefix.static String[]
toString()
-
Field Details
-
INBOUND
public static final int INBOUNDdefines the 'inbound' direction, that is mapping request path to item path- See Also:
-
OUTBOUND
public static final int OUTBOUNDdefined the 'outbound' direction, that is mapping item path to URL path- See Also:
-
BOTH
public static final int BOTHdefines the 'both' direction- See Also:
-
DIRECT
Simple mapper instance mapping path to URLs 1:1 in both directions
-
-
Constructor Details
-
Mapping
-
Mapping
-
-
Method Details
-
toString
-
mapUri
Replaces the prefix to by the new prefix from, if and only ifuriPath
starts with the to prefix. IfuriPath
does not start with the to prefix, or if this mapping is not defined as a 'inward' mapping,null
is returned.- Parameters:
uriPath
- The URI path for which to replace the to prefix by the from prefix.- Returns:
- The string after replacement or
null
if theuriPath
does not start with the to prefix, ormapsInbound()
returnsfalse
.
-
mapHandle
Replaces the prefix from by the new prefix to, if and only ifhandle
starts with the from prefix. IfuriPath
does not start with the from prefix, or if this mapping is not defined as a 'outward' mapping,null
is returned.- Parameters:
handle
- The URI path for which to replace the from prefix by the to prefix.- Returns:
- The string after replacement or
null
if thehandle
does not start with the from prefix, ormapsOutbound()
returnsfalse
.
-
getFrom
-
getTo
-
mapsInbound
public boolean mapsInbound()Checks, if this mapping is defined for inbound mapping.- Returns:
true
if this mapping is defined for inbound mapping;false
otherwise
-
mapsOutbound
public boolean mapsOutbound()Checks, if this mapping is defined for outbound mapping.- Returns:
true
if this mapping is defined for outbound mapping;false
otherwise
-
split
-