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
FieldsModifier and TypeFieldDescriptionstatic final intdefines the 'both' directionstatic final MappingSimple mapper instance mapping path to URLs 1:1 in both directionsstatic final intdefines the 'inbound' direction, that is mapping request path to item pathstatic final intdefined the 'outbound' direction, that is mapping item path to URL path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFrom()getTo()Replaces the prefix from by the new prefix to, if and only ifhandlestarts with the from prefix.booleanChecks, if this mapping is defined for inbound mapping.booleanChecks, if this mapping is defined for outbound mapping.Replaces the prefix to by the new prefix from, if and only ifuriPathstarts 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 ifuriPathstarts with the to prefix. IfuriPathdoes not start with the to prefix, or if this mapping is not defined as a 'inward' mapping,nullis returned.- Parameters:
uriPath- The URI path for which to replace the to prefix by the from prefix.- Returns:
- The string after replacement or
nullif theuriPathdoes not start with the to prefix, ormapsInbound()returnsfalse.
-
mapHandle
Replaces the prefix from by the new prefix to, if and only ifhandlestarts with the from prefix. IfuriPathdoes not start with the from prefix, or if this mapping is not defined as a 'outward' mapping,nullis returned.- Parameters:
handle- The URI path for which to replace the from prefix by the to prefix.- Returns:
- The string after replacement or
nullif thehandledoes not start with the from prefix, ormapsOutbound()returnsfalse.
-
getFrom
-
getTo
-
mapsInbound
public boolean mapsInbound()Checks, if this mapping is defined for inbound mapping.- Returns:
trueif this mapping is defined for inbound mapping;falseotherwise
-
mapsOutbound
public boolean mapsOutbound()Checks, if this mapping is defined for outbound mapping.- Returns:
trueif this mapping is defined for outbound mapping;falseotherwise
-
split
-