Package javax.servlet

# Interface Registration

All Known Subinterfaces:
  `FilterRegistration`, `FilterRegistration.Dynamic`, `Registration.Dynamic`, `ServletRegistration`, `ServletRegistration.Dynamic`

public interface Registration
Common interface for the registration of Filters and Servlets.

Since:
  Servlet 3.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `Registration.Dynamic`
  Interface through which a Servlet or Filter registered via one of the addServlet or addFilter methods, respectively, on ServletContext may be further configured.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getClassName()`
  Obtain the name of the implementation class for the Servlet.
  `String`
  `getInitParameter(String name)`
  Get the value of an initialisation parameter.
  `Map<String,String>`
  `getInitParameters()`
  Get the names and values of all the initialisation parameters.
  `String`
  `getName()`
  Obtain the name of the Servlet.
  `boolean`
  `setInitParameter(String name, String value)`
  Add an initialisation parameter if not already added.
  `Set<String>`
  `setInitParameters(Map<String,String> initParameters)`
  Add multiple initialisation parameters.

- ## Method Details

  - ### getName

    String getName()
    Obtain the name of the Servlet.
    Returns:
      the name of the Servlet.

  - ### getClassName

    String getClassName()
    Obtain the name of the implementation class for the Servlet.
    Returns:
      the name of the implementation class for the Servlet.

  - ### setInitParameter

    boolean setInitParameter(String name, String value)
    Add an initialisation parameter if not already added.
    Parameters:
      `name` - Name of initialisation parameter
      `value` - Value of initialisation parameter
    Returns:
      `true` if the initialisation parameter was set, `false` if the initialisation parameter was not set because an initialisation parameter of the same name already existed
    Throws:
      `IllegalArgumentException` - if name or value is `null`
      `IllegalStateException` - if the ServletContext associated with this registration has already been initialised

  - ### getInitParameter

    String getInitParameter(String name)
    Get the value of an initialisation parameter.
    Parameters:
      `name` - The initialisation parameter whose value is required
    Returns:
      The value of the named initialisation parameter

  - ### setInitParameters

    Set<String> setInitParameters(Map<String,String> initParameters)
    Add multiple initialisation parameters. If any of the supplied initialisation parameter conflicts with an existing initialisation parameter, no updates will be performed.
    Parameters:
      `initParameters` - The initialisation parameters to add
    Returns:
      The set of initialisation parameter names that conflicted with existing initialisation parameter. If there are no conflicts, this Set will be empty.
    Throws:
      `IllegalArgumentException` - if any of the supplied initialisation parameters have a null name or value
      `IllegalStateException` - if the ServletContext associated with this registration has already been initialised

  - ### getInitParameters

    Map<String,String> getInitParameters()
    Get the names and values of all the initialisation parameters.
    Returns:
      A Map of initialisation parameter names and associated values keyed by name