org.apache.sling.bgservlets.impl

## Class BackgroundServletStarterFilter

- java.lang.Object
- - org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter

All Implemented Interfaces:
  javax.servlet.Filter

    @Service
    @Properties(value={@Property(name="sling.filter.scope",value="request",propertyPrivate=true),@Property(name="service.ranking",intValue=1000000000,propertyPrivate=true)})
    public class BackgroundServletStarterFilter
    extends Object
    implements javax.servlet.Filter

Filter that runs the current request in the background if specific request parameters are set. Must be placed early in the filter chain.

### Field Summary

Fields
`static String[]` `DEFAULT_ALLOWED_METHODS` Default list of HTTP method names that can trigger background requests
`static String` `DEFAULT_BG_PARAM` Default value of the "put in background" parameter
`static String` `PROP_ALLOWED_METHODS` Name of the property that defines the list of allowed HTTP methods to trigger background jobs
`static String` `PROP_BG_PARAM` Name of the property that defines the request parameter name to use to start a servlet in the background.

### Constructor Summary

Constructors
Constructor and Description
`BackgroundServletStarterFilter()`

### Method Summary

Methods
`protected void` `activate(Map<String,Object> props)`
`void` `destroy()`
`void` `doFilter(javax.servlet.ServletRequest sreq, javax.servlet.ServletResponse sresp, javax.servlet.FilterChain chain)`
`void` `init(javax.servlet.FilterConfig cfg)`

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

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

### Field Detail

#### DEFAULT_BG_PARAM

    public static final String DEFAULT_BG_PARAM

Default value of the "put in background" parameter

See Also:
  Constant Field Values

#### PROP_BG_PARAM

    @Property(value="sling:bg")
    public static final String PROP_BG_PARAM

Name of the property that defines the request parameter name to use to start a servlet in the background.

See Also:
  Constant Field Values

#### DEFAULT_ALLOWED_METHODS

    public static final String[] DEFAULT_ALLOWED_METHODS

Default list of HTTP method names that can trigger background requests

#### PROP_ALLOWED_METHODS

    @Property
    public static final String PROP_ALLOWED_METHODS

Name of the property that defines the list of allowed HTTP methods to trigger background jobs

See Also:
  Constant Field Values

### Constructor Detail

#### BackgroundServletStarterFilter

    public BackgroundServletStarterFilter()

### Method Detail

#### activate

    @Activate
    protected void activate(Map<String,Object> props)

#### doFilter

    public void doFilter(javax.servlet.ServletRequest sreq,
                javax.servlet.ServletResponse sresp,
                javax.servlet.FilterChain chain)
                  throws IOException,
                         javax.servlet.ServletException

Specified by:
  `doFilter` in interface `javax.servlet.Filter`
Throws:
  `IOException`
  `javax.servlet.ServletException`

#### destroy

    public void destroy()

Specified by:
  `destroy` in interface `javax.servlet.Filter`

#### init

    public void init(javax.servlet.FilterConfig cfg)
              throws javax.servlet.ServletException

Specified by:
  `init` in interface `javax.servlet.Filter`
Throws:
  `javax.servlet.ServletException`