Package: groovy.servlet

## [Java] Class AbstractHttpServlet

- groovy.servlet.AbstractHttpServlet

- All Implemented Interfaces and Traits:
    ResourceConnector

      public abstract class AbstractHttpServlet
      extends HttpServlet
      implements ResourceConnector

  A base class dealing with common HTTP servlet API housekeeping aspects.

  #### Resource name mangling (pattern replacement)

  Also implements Groovy's ResourceConnector in a dynamic manner. It allows you to modify the resource name that is searched for with a replace all operation. See Pattern and Matcher for details. The servlet init parameter names are:

       {value:#INIT_PARAM_RESOURCE_NAME_REGEX} = empty - defaults to null
       resource.name.replacement = empty - defaults to null
       resource.name.replace.all = true (default) | false means replaceFirst()

  Note: If you specify a regex, you have to specify a replacement string too! Otherwise an exception gets raised.

  #### Logging and bug-hunting options

  This implementation provides a verbosity flag switching log statements. The servlet init parameter name is:

       verbose = false(default) | true

  In order to support class-loading-troubles-debugging with Tomcat 4 or higher, you can log the class loader responsible for loading some classes. See GROOVY-861 for details. The servlet init parameter name is:

       log.GROOVY861 = false(default) | true

  If you experience class-loading-troubles with Tomcat 4 (or higher) or any other servlet container using custom class loader setups, you can fallback to use (slower) reflection in Groovy's MetaClass implementation. Please contact the dev team with your problem! Thanks. The servlet init parameter name is:

       reflection = false(default) | true

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `CONTENT_TYPE_TEXT_HTML` | Content type of the HTTP response.
    `static String` | `INC_PATH_INFO` | Servlet API include key name: path_info
    `static String` | `INC_REQUEST_URI` |
    `static String` | `INC_SERVLET_PATH` | Servlet API include key name: servlet_path
    `static String` | `INIT_PARAM_RESOURCE_NAME_REGEX` |
    `static String` | `INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `AbstractHttpServlet()` Initializes all fields with default values.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public URLConnection` | `getResourceConnection(String name)` Interface method for ResourceContainer.
    `` | `public void` | `init(ServletConfig config)` Overrides the generic init method to set some debug flags.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class HttpServlet` | `service, log, log, init, init, destroy, getInitParameterNames, getInitParameter, getServletContext, getServletName, getServletConfig, getServletInfo, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String CONTENT_TYPE_TEXT_HTML

      Content type of the HTTP response.

    - #### public static final String INC_PATH_INFO

      Servlet API include key name: path_info

    - #### public static final String INC_REQUEST_URI

    - #### public static final String INC_SERVLET_PATH

      Servlet API include key name: servlet_path

    - #### public static final String INIT_PARAM_RESOURCE_NAME_REGEX

    - #### public static final String INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS

  - ### Constructor Detail

    - #### public AbstractHttpServlet()

      Initializes all fields with default values.

  - ### Method Detail

    - #### @Override
      public URLConnection getResourceConnection(String name)

      Interface method for ResourceContainer. This is used by the GroovyScriptEngine.

    - #### @Override
      public void init(ServletConfig config)

      Overrides the generic init method to set some debug flags.

      throws:
        ServletException if init() method defined in super class javax.servlet.GenericServlet throws it
      Parameters:
        `config` - the servlet configuration provided by the container