CoyoteAdapter (Apache Tomcat 7.0.96 API Documentation)

org.apache.catalina.connector

## Class CoyoteAdapter

- java.lang.Object
- - org.apache.catalina.connector.CoyoteAdapter

- All Implemented Interfaces:
    Adapter

      public class CoyoteAdapter
      extends java.lang.Object
      implements Adapter

  Implementation of a request processor which delegates the processing to a Coyote processor.
  Author:
    Craig R. McClanahan, Remy Maucherat

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ADAPTER_NOTES`
    `protected static boolean` | `ALLOW_BACKSLASH`
    `protected static StringManager` | `sm` The string manager for this package.
    `protected static URLEncoder` | `urlEncoder` Encoder for the Location URL in HTTP redirects.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CoyoteAdapter(Connector connector)` Construct a new CoyoteProcessor associated with the specified connector.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `asyncDispatch(Request req, Response res, SocketStatus status)`
    `static boolean` | `checkNormalize(MessageBytes uriMB)` Check that the URI is normalized following character decoding.
    `void` | `checkRecycled(Request req, Response res)` Assert that request and response have been recycled.
    `protected void` | `convertMB(MessageBytes mb)` Character conversion of the a US-ASCII MessageBytes.
    `protected void` | `convertURI(MessageBytes uri, Request request)` Character conversion of the URI.
    `protected static void` | `copyBytes(byte[] b, int dest, int src, int len)` Copy an array of bytes to a different position.
    `void` | `errorDispatch(Request req, Response res)`
    `boolean` | `event(Request req, Response res, SocketStatus status)` Event method.
    `java.lang.String` | `getDomain()` Provide the name of the domain to use to register MBeans for components associated with the connector.
    `void` | `log(Request req, Response res, long time)`
    `static boolean` | `normalize(MessageBytes uriMB)` Normalize URI.
    `protected void` | `parsePathParameters(Request req, Request request)` Extract the path parameters from the request.
    `protected void` | `parseSessionCookiesId(Request req, Request request)` Parse session id in Cookie.
    `protected void` | `parseSessionSslId(Request request)` Look for SSL session ID if required.
    `protected boolean` | `postParseRequest(Request req, Request request, Response res, Response response)` Parse additional request parameters.
    `void` | `service(Request req, Response res)` Service method.

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

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

- - ### Field Detail

    - #### ADAPTER_NOTES

          public static final int ADAPTER_NOTES

      See Also:
        Constant Field Values

    - #### ALLOW_BACKSLASH

          protected static final boolean ALLOW_BACKSLASH

    - #### sm

          protected static final StringManager sm

      The string manager for this package.

    - #### urlEncoder

          protected static URLEncoder urlEncoder

      Encoder for the Location URL in HTTP redirects.

  - ### Constructor Detail

    - #### CoyoteAdapter

          public CoyoteAdapter(Connector connector)

      Construct a new CoyoteProcessor associated with the specified connector.
      Parameters:
        `connector` - CoyoteConnector that owns this processor

  - ### Method Detail

    - #### event

          public boolean event(Request req,
                      Response res,
                      SocketStatus status)

      Event method.
      Specified by:
        `event` in interface `Adapter`
      Returns:
        false to indicate an error, expected or not

    - #### asyncDispatch

          public boolean asyncDispatch(Request req,
                              Response res,
                              SocketStatus status)
                                throws java.lang.Exception

      Specified by:
        `asyncDispatch` in interface `Adapter`
      Throws:
        `java.lang.Exception`

    - #### service

          public void service(Request req,
                     Response res)
                       throws java.lang.Exception

      Service method.
      Specified by:
        `service` in interface `Adapter`
      Throws:
        `java.lang.Exception` - if an error happens during handling of the request. Common errors are:
        - IOException if an input/output error occurs and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
        - ServletException if a servlet throws an exception and we are processing an included servlet (otherwise it is swallowed and handled by the top level error handler mechanism)
        Tomcat should be able to handle and log any other exception ( including runtime exceptions )

    - #### errorDispatch

          public void errorDispatch(Request req,
                           Response res)

      Specified by:
        `errorDispatch` in interface `Adapter`

    - #### log

          public void log(Request req,
                 Response res,
                 long time)

      Specified by:
        `log` in interface `Adapter`

    - #### checkRecycled

          public void checkRecycled(Request req,
                           Response res)

      Description copied from interface: `Adapter`
      Assert that request and response have been recycled. If they have not then log a warning and force a recycle. This method is called as a safety check when a processor is being recycled and may be returned to a pool for reuse.
      Specified by:
        `checkRecycled` in interface `Adapter`
      Parameters:
        `req` - Request
        `res` - Response

    - #### getDomain

          public java.lang.String getDomain()

      Description copied from interface: `Adapter`
      Provide the name of the domain to use to register MBeans for components associated with the connector.
      Specified by:
        `getDomain` in interface `Adapter`
      Returns:
        The MBean domain name

    - #### postParseRequest

          protected boolean postParseRequest(Request req,
                                 Request request,
                                 Response res,
                                 Response response)
                                      throws java.lang.Exception

      Parse additional request parameters.
      Throws:
        `java.lang.Exception`

    - #### parsePathParameters

          protected void parsePathParameters(Request req,
                                 Request request)

      Extract the path parameters from the request. This assumes parameters are of the form /path;name=value;name2=value2/ etc. Currently only really interested in the session ID that will be in this form. Other parameters can safely be ignored.
      Parameters:
        `req` -
        `request` -

    - #### parseSessionSslId

          protected void parseSessionSslId(Request request)

      Look for SSL session ID if required. Only look for SSL Session ID if it is the only tracking method enabled.

    - #### parseSessionCookiesId

          protected void parseSessionCookiesId(Request req,
                                   Request request)

      Parse session id in Cookie.

    - #### convertURI

          protected void convertURI(MessageBytes uri,
                        Request request)
                             throws java.lang.Exception

      Character conversion of the URI.
      Throws:
        `java.lang.Exception`

    - #### convertMB

          protected void convertMB(MessageBytes mb)

      Character conversion of the a US-ASCII MessageBytes.

    - #### normalize

          public static boolean normalize(MessageBytes uriMB)

      Normalize URI.

      This method normalizes "\", "//", "/./" and "/../". This method will return false when trying to go above the root, or if the URI contains a null byte.

      Parameters:
        `uriMB` - URI to be normalized

    - #### checkNormalize

          public static boolean checkNormalize(MessageBytes uriMB)

      Check that the URI is normalized following character decoding.

      This method checks for "\", 0, "//", "/./" and "/../". This method will return false if sequences that are supposed to be normalized are still present in the URI.

      Parameters:
        `uriMB` - URI to be checked (should be chars)

    - #### copyBytes

          protected static void copyBytes(byte[] b,
                       int dest,
                       int src,
                       int len)

      Copy an array of bytes to a different position. Used during normalization.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.