Class Mapping
- java.lang.Object
-
- org.apache.sling.resourceresolver.impl.mapping.Mapping
-
public class Mapping extends Object
TheMappingclass conveys the mapping configuration used by theResourceResolverFactoryImpl.
-
-
Field Summary
Fields Modifier and Type Field Description static intBOTHdefines the 'both' directionstatic MappingDIRECTSimple mapper instance mapping path to URLs 1:1 in both directionsstatic intINBOUNDdefines the 'inbound' direction, that is mapping request path to item pathstatic intOUTBOUNDdefined the 'outbound' direction, that is mapping item path to URL path
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetFrom()StringgetTo()StringmapHandle(String handle)Replaces the prefix from by the new prefix to, if and only ifhandlestarts with the from prefix.booleanmapsInbound()Checks, if this mapping is defined for inbound mapping.booleanmapsOutbound()Checks, if this mapping is defined for outbound mapping.StringmapUri(String uriPath)Replaces the prefix to by the new prefix from, if and only ifuriPathstarts with the to prefix.static String[]split(String map)StringtoString()
-
-
-
Field Detail
-
INBOUND
public static final int INBOUND
defines the 'inbound' direction, that is mapping request path to item path- See Also:
- Constant Field Values
-
OUTBOUND
public static final int OUTBOUND
defined the 'outbound' direction, that is mapping item path to URL path- See Also:
- Constant Field Values
-
BOTH
public static final int BOTH
defines the 'both' direction- See Also:
- Constant Field Values
-
DIRECT
public static final Mapping DIRECT
Simple mapper instance mapping path to URLs 1:1 in both directions
-
-
Method Detail
-
mapUri
public String mapUri(String uriPath)
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
public String mapHandle(String handle)
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
public String getFrom()
-
getTo
public String 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
-
-