Package org.apache.sling.api.servlets

# Class ServletResolverConstants

java.lang.Object
org.apache.sling.api.servlets.ServletResolverConstants

public final class ServletResolverConstants extends Object
Service registration properties and common values used for registering a Sling Servlet.

Since:
  2.2.0
See Also:
  - Servlets and Scripts

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DEFAULT_ERROR_HANDLER_METHOD`
The HTTP "method" name of an error handler used as the default (value is "default").
`static final String`
`DEFAULT_ERROR_HANDLER_RESOURCE_TYPE`
The resource type used to select error handlers (value is "sling/servlet/errorhandler").
`static final String`
`DEFAULT_RESOURCE_TYPE`
The resource type of a registered servlet used as the default servlet if no other (more specific) servlet or script could be selected (value is "sling/servlet/default").
`static final String`
`SLING_SERVLET_EXTENSIONS`
The name of the service registration property of a servlet registered as a service containing the request URL extensions supported by the servlet for GET requests (value is "sling.servlet.extensions").
`static final String`
`SLING_SERVLET_METHODS`
The name of the service registration property of a servlet registered as a service containing the request methods supported by the servlet (value is "sling.servlet.methods").
`static final String`
`SLING_SERVLET_NAME`
The name of the service registration property of a Servlet registered as a service containing the name of the servlet (value is "sling.core.servletName").
`static final String`
`SLING_SERVLET_PATHS`
The name of the service registration property of a servlet registered as a service providing the absolute paths under which the servlet is accessible as a resource (value is "sling.servlet.paths").
`static final String`
`SLING_SERVLET_PATHS_STRICT`
When set to `true` the strict selection mode for path based servlets is enabled (value is "sling.servlet.paths.strict").
`static final String`
`SLING_SERVLET_PREFIX`
The name of the service registration property of a servlet registered as a service providing the prefix/index to be used to register this servlet.
`static final String`
`SLING_SERVLET_RESOURCE_SUPER_TYPE`
The name of the service registration property of a servlet registered as a service containing the resource super type supported by the servlet (value is "sling.servlet.resourceSuperType").
`static final String`
`SLING_SERVLET_RESOURCE_TYPES`
The name of the service registration property of a servlet registered as a service containing the resource type(s) supported by the servlet (value is "sling.servlet.resourceTypes").
`static final String`
`SLING_SERVLET_SELECTORS`
The name of the service registration property of a Servlet registered as a service containing the request URL selectors supported by the servlet (value is "sling.servlet.selectors").

## Constructor Summary

Constructors
Constructor
Description
`ServletResolverConstants()`

## Method Summary

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

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

## Field Details

### SLING_SERVLET_PATHS

public static final String SLING_SERVLET_PATHS
The name of the service registration property of a servlet registered as a service providing the absolute paths under which the servlet is accessible as a resource (value is "sling.servlet.paths"). A relative path is made absolute by prefixing it with the value set through the `SLING_SERVLET_PREFIX` property.

The type of this property is a String or String[] (array of strings) denoting the path(s) under which the servlet is registered in the resource tree.

Either this property or the `SLING_SERVLET_RESOURCE_TYPES` property must be set or the servlet is ignored. If both are set the servlet is registered using both ways.

A servlet using this property might be ignored unless its path is included in the Execution Paths `servletresolver.paths` configuration setting of the `org.apache.sling.servlets.resolver.internal.SlingServletResolver` service.

See Also:
  - Constant Field Values

### SLING_SERVLET_PATHS_STRICT

public static final String SLING_SERVLET_PATHS_STRICT
When set to `true` the strict selection mode for path based servlets is enabled (value is "sling.servlet.paths.strict"). In strict mode, the configured selectors, extensions and methods are taken into account to select servlets. If this property is not set to `true` the behavior is unchanged from previous versions and only the `SLING_SERVLET_PATHS` property is considered when selecting servlets. The special value `.EMPTY.` can be used for the `SLING_SERVLET_SELECTORS` and `SLING_SERVLET_EXTENSIONS` properties to require the corresponding request values to be empty for the servlet to be selected.

Since:
  2.5.0
See Also:
  - Constant Field Values

### SLING_SERVLET_RESOURCE_TYPES

public static final String SLING_SERVLET_RESOURCE_TYPES
The name of the service registration property of a servlet registered as a service containing the resource type(s) supported by the servlet (value is "sling.servlet.resourceTypes"). A relative resource type is made absolute by prefixing it with the value set through the `SLING_SERVLET_PREFIX` property.

The type of this property is a String or String[] (array of strings) denoting the resource types.

Either this property or the `SLING_SERVLET_PATHS` property must be set, or the servlet is ignored. If both are set, the servlet is registered using both ways.

See Also:
  - Constant Field Values

### SLING_SERVLET_RESOURCE_SUPER_TYPE

public static final String SLING_SERVLET_RESOURCE_SUPER_TYPE
The name of the service registration property of a servlet registered as a service containing the resource super type supported by the servlet (value is "sling.servlet.resourceSuperType").

The type of this property is a String denoting the resource super type. This property is ignored if the `SLING_SERVLET_RESOURCE_TYPES` property is not set. Otherwise this property is optional and ignored if not set.

See Also:
  - Constant Field Values

### SLING_SERVLET_PREFIX

public static final String SLING_SERVLET_PREFIX

The name of the service registration property of a servlet registered as a service providing the prefix/index to be used to register this servlet. It only is applied as prefix to `SLING_SERVLET_PATHS` and `SLING_SERVLET_RESOURCE_TYPES` in case they do not start with a "/".

- If the value of this property is a number, it defines the index of the search path entries from the resource resolver. The defined search path is used as a prefix to mount this servlet. The number can be -1 which always points to the last search entry. If the specified value is higher than than the highest index of the search paths, the last entry is used. The index starts with 0. If the value of this property is a string and parseable as a number, the above logic is used.
- If the value of this property is a string starting with "/", this value is applied as a prefix, regardless of the configured search paths!
- If the value is anything else, it is ignored.

If this property is not specified, the configuration of the `org.apache.sling.servlets.resolver.internal.SlingServletResolver` service is used. In case even that one is not set "/" is used as prefix.

See Also:
  - Constant Field Values

### SLING_SERVLET_SELECTORS

public static final String SLING_SERVLET_SELECTORS
The name of the service registration property of a Servlet registered as a service containing the request URL selectors supported by the servlet (value is "sling.servlet.selectors"). The selectors must be configured as they would be specified in the URL that is as a list of dot-separated strings such as print.a4.

The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the `SLING_SERVLET_RESOURCE_TYPES` property is not set. Otherwise this property is optional and ignored if not set.

See Also:
  - Constant Field Values

### SLING_SERVLET_EXTENSIONS

public static final String SLING_SERVLET_EXTENSIONS
The name of the service registration property of a servlet registered as a service containing the request URL extensions supported by the servlet for GET requests (value is "sling.servlet.extensions").

The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the `SLING_SERVLET_RESOURCE_TYPES` property is not set. Otherwise this property is optional and ignored if not set.

See Also:
  - Constant Field Values

### SLING_SERVLET_METHODS

public static final String SLING_SERVLET_METHODS
The name of the service registration property of a servlet registered as a service containing the request methods supported by the servlet (value is "sling.servlet.methods"). The value may be one of the HTTP methods or "*" for all methods.

The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the `SLING_SERVLET_RESOURCE_TYPES` property is not set. Otherwise this property is optional and assumed to be `GET` and `HEAD` if not set.

See Also:
  - HTTP 1.1 Spec Methods
  - Constant Field Values

### SLING_SERVLET_NAME

public static final String SLING_SERVLET_NAME
The name of the service registration property of a Servlet registered as a service containing the name of the servlet (value is "sling.core.servletName"). If this property is missing or empty, the `component.name` property or the `service.pid` is used. If none of the three properties is defined, the Servlet is ignored.

See Also:
  - `ServletConfig.getServletName()`
  - Constant Field Values

### DEFAULT_RESOURCE_TYPE

public static final String DEFAULT_RESOURCE_TYPE
The resource type of a registered servlet used as the default servlet if no other (more specific) servlet or script could be selected (value is "sling/servlet/default"). If no servlet is registered under this name, the `org.apache.sling.servlets.resolver.internal.defaults.DefaultServlet` is used.

See Also:
  - Default Servlet(s)
  - Constant Field Values

### DEFAULT_ERROR_HANDLER_RESOURCE_TYPE

public static final String DEFAULT_ERROR_HANDLER_RESOURCE_TYPE
The resource type used to select error handlers (value is "sling/servlet/errorhandler").

See Also:
  - Errorhandling
  - Constant Field Values

### DEFAULT_ERROR_HANDLER_METHOD

public static final String DEFAULT_ERROR_HANDLER_METHOD
The HTTP "method" name of an error handler used as the default (value is "default").

See Also:
  - Default Error Handle
  - Constant Field Values

## Constructor Details

### ServletResolverConstants

public ServletResolverConstants()