Package org.apache.sling.resourceresolver.impl.mapping

# Class MapEntry

java.lang.Object
org.apache.sling.resourceresolver.impl.mapping.MapEntry

All Implemented Interfaces:
  `Comparable<MapEntry>`

public class MapEntry extends Object implements Comparable<MapEntry>
The `MapEntry` class represents a mapping entry in the mapping configuration tree at `/etc/map`.

See Also:
  - Mappings for Resource Resolution

## Constructor Summary

Constructors
Constructor
Description
`MapEntry(String url, int status, boolean trailingSlash, long order, String... redirect)`

## Method Summary

Modifier and Type
Method
Description
`static String`
`appendSlash(String path)`
`int`
`compareTo(MapEntry m)`
`static List<MapEntry>`
`createMapEntry(String url, org.apache.sling.api.resource.Resource resource, boolean trailingSlash)`
`static MapEntry`
`createResolveEntry(String url, org.apache.sling.api.resource.Resource resource, boolean trailingSlash)`
`static String`
`fixUriPath(String uriPath)`
`String`
`getPattern()`
`String[]`
`getRedirect()`
`int`
`getStatus()`
`static String`
`getURI(String scheme, String host, int port, String path)`
Returns a string used for matching map entries against the given request or URI parts.
`boolean`
`isInternal()`
`@Nullable String[]`
`replace(@NotNull String value)`
Replaces the specified value according to the rules of this entry
`String`
`toString()`
`static String`
`toURI(String uriPath)`
Converts the resolution path of the form http/host.77/the/path into an URI of the form http://host:77/the/path where any potential default port (80 for http and 443 for https) is actually removed.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MapEntry

public MapEntry(String url, int status, boolean trailingSlash, long order, String... redirect)

## Method Details

### appendSlash

public static String appendSlash(String path)

### getURI

public static String getURI(String scheme, String host, int port, String path)
Returns a string used for matching map entries against the given request or URI parts.

Parameters:
  `scheme` - The URI scheme
  `host` - The host name
  `port` - The port number. If this is negative, the default value used is 80 unless the scheme is "https" in which case the default value is 443.
  `path` - The (absolute) path
Returns:
  The request path string {scheme}://{host}:{port}{path}.

### fixUriPath

public static String fixUriPath(String uriPath)

### toURI

public static String toURI(String uriPath)
Converts the resolution path of the form http/host.77/the/path into an URI of the form http://host:77/the/path where any potential default port (80 for http and 443 for https) is actually removed. If the path is just a regular path such as /the/path, this method returns `null`.

Parameters:
  `uriPath` - the uripath
Returns:
  the cleaned URI string

### createResolveEntry

public static MapEntry createResolveEntry(String url, org.apache.sling.api.resource.Resource resource, boolean trailingSlash)

### createMapEntry

public static List<MapEntry> createMapEntry(String url, org.apache.sling.api.resource.Resource resource, boolean trailingSlash)

### replace

@Nullable public @Nullable String[] replace(@NotNull @NotNull String value)
Replaces the specified value according to the rules of this entry

Parameters:
  `value` - the value to replace
Returns:
  a replaced value of `null` if the value does not match

### getPattern

public String getPattern()

### getRedirect

public String[] getRedirect()

### isInternal

public boolean isInternal()

### getStatus

public int getStatus()

### compareTo

public int compareTo(MapEntry m)

Specified by:
  `compareTo` in interface `Comparable<MapEntry>`

### toString

public String toString()

Overrides:
  `toString` in class `Object`