Adapter (Apache Tomcat 9.0.102 API Documentation)
Description: declaration: package: org.apache.coyote, interface: Adapter

Package org.apache.coyote

# Interface Adapter

All Known Implementing Classes:
  `CoyoteAdapter`

public interface Adapter
Adapter. This represents the entry point in a coyote-based servlet container.

Author:
  Remy Maucherat
See Also:
  - `ProtocolHandler`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `asyncDispatch(Request req, Response res, SocketEvent status)`
  Dispatch asynchronous event.
  `void`
  `checkRecycled(Request req, Response res)`
  Assert that request and response have been recycled.
  `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)`
  Callback to allow logging access outside of the execution of the regular service.
  `boolean`
  `prepare(Request req, Response res)`
  Prepare the given request/response for processing.
  `void`
  `service(Request req, Response res)`
  Call the service method, and notify all listeners.

- ## Method Details

  - ### service

    void service(Request req, Response res) throws Exception
    Call the service method, and notify all listeners.
    Parameters:
      `req` - The request object
      `res` - The response object
    Throws:
      `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 )

  - ### prepare

    boolean prepare(Request req, Response res) throws Exception
    Prepare the given request/response for processing. This method requires that the request object has been populated with the information available from the HTTP headers.
    Parameters:
      `req` - The request object
      `res` - The response object
    Returns:
      `true` if processing can continue, otherwise `false` in which case an appropriate error will have been set on the response
    Throws:
      `Exception` - If the processing fails unexpectedly

  - ### asyncDispatch

    boolean asyncDispatch(Request req, Response res, SocketEvent status) throws Exception
    Dispatch asynchronous event.
    Parameters:
      `req` - the request object
      `res` - the response object
      `status` - the event being processed
    Returns:
      `true` if the dispatch was successful
    Throws:
      `Exception` - If the processing fails unexpectedly

  - ### log

    void log(Request req, Response res, long time)
    Callback to allow logging access outside of the execution of the regular service.
    Parameters:
      `req` - the request object
      `res` - the response object
      `time` - time taken to process the request/response in milliseconds (use 0 if not known)

  - ### checkRecycled

    void checkRecycled(Request req, Response res)
    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.
    Parameters:
      `req` - Request
      `res` - Response

  - ### getDomain

    String getDomain()
    Provide the name of the domain to use to register MBeans for components associated with the connector.
    Returns:
      The MBean domain name