org.apache.felix.scr.annotations.sling

## Annotation Type SlingFilter

    @Target(value=TYPE)
    @Retention(value=CLASS)
    @Documented
    public @interface SlingFilter

Marks servlet classes as SCR component, and allows to add a filter to Apache Sling's request processing. This annotation generates two private properties for the order and the scope. By default it also generates a component and a service tag, but this generation can be omitted.

See Also:
  Sling Servlet Filter Support

### Required Element Summary

Required Elements
`int` `order` The order of the filter.

### Optional Element Summary

Optional Elements
`String` `description` This is generally used as a description for the object described by the meta type.
`boolean` `generateComponent` Whether to generate a default SCR component tag with.
`boolean` `generateService` Whether to generate a default SCR service tag with "interface=javax.servlet.Filter".
`String` `label` This is generally used as a title for the object described by the meta type.
`boolean` `metatype` Whether Metatype Service data is generated or not.
`String` `name` Defines the Component name also used as the PID for the Configuration Admin Service.
`String` `pattern` Restrict the filter to paths that match the supplied regular expression.
`SlingFilterScope[]` `scope` The scopes of a filter.

### Element Detail

#### order

    public abstract int order

The order of the filter. This value is used to sort the filters. Filters with a higher order are executed before a filter with a lower order. If two filters have the same order, the one with the lower service id is executed first. At build time this element will be translated into a `service.ranking` property with the given value.
Please note that the ordering is actually depending on the used Apache Sling Engine bundle version. Version older than 2.3.4 of that bundle are sorting the filters in the wrong reverse order. Make sure to run a newer version of the Sling engine to get the correct ordering (see also SLING-2920).

#### pattern

    public abstract String pattern

Restrict the filter to paths that match the supplied regular expression. Requires Sling Engine 2.4.0.

Since:
  1.10.0

Default:
  ""

#### scope

    public abstract SlingFilterScope[] scope

The scopes of a filter. If the filter has request scope, it is run once for a request. If the filter has component scope, it is run once for every included component (rendering).

Default:
  org.apache.felix.scr.annotations.sling.SlingFilterScope.REQUEST

#### generateComponent

    public abstract boolean generateComponent

Whether to generate a default SCR component tag with. If set to false, a `Component` annotation can be added manually with defined whatever configuration needed.

Default:
  true

#### generateService

    public abstract boolean generateService

Whether to generate a default SCR service tag with "interface=javax.servlet.Filter". If set to false, a `Service` annotation can be added manually with defined whatever configuration needed.

Default:
  true

#### name

    public abstract String name

Defines the Component name also used as the PID for the Configuration Admin Service. Default value: Fully qualified name of the Java class.

Default:
  ""

#### metatype

    public abstract boolean metatype

Whether Metatype Service data is generated or not. If this parameter is set to true Metatype Service data is generated in the `metatype.xml` file for this component. Otherwise no Metatype Service data is generated for this component.

Default:
  false

#### label

    public abstract String label

This is generally used as a title for the object described by the meta type. This name may be localized by prepending a % sign to the name. Default value: %<name>.name

Default:
  ""

#### description

    public abstract String description

This is generally used as a description for the object described by the meta type. This name may be localized by prepending a % sign to the name. Default value: %<name>.description

Default:
  ""