Class CoyoteAdapter


  • public class CoyoteAdapter
    extends org.glassfish.grizzly.http.server.HttpHandler
    Implementation of a request processor which delegates the processing to a Coyote processor.
    Version:
    $Revision: 1.34 $ $Date: 2007/08/24 18:38:28 $
    Author:
    Craig R. McClanahan, Remy Maucherat
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static boolean ALLOW_BACKSLASH  
      protected static org.glassfish.grizzly.http.Note<org.glassfish.grizzly.http.server.util.MappingData> MAPPING_DATA  
    • Constructor Summary

      Constructors 
      Constructor Description
      CoyoteAdapter​(Connector connector)
      Construct a new CoyoteProcessor associated with the specified connector.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void copyBytes​(byte[] b, int dest, int src, int len)
      Copy an array of bytes to a different position.
      void fireAdapterEvent​(String type, Object data)
      Notify all container event listeners that a particular event has occurred for this Adapter.
      int getPort()
      Gets the port of this CoyoteAdapter.
      boolean isCompatWithTomcat()
      Return true when an instance is executed the same way it does in Tomcat.
      protected void log​(String message)
      Log a message on the Logger associated with our Container (if any)
      protected void log​(String message, Throwable throwable)
      Log a message on the Logger associated with our Container (if any)
      static void normalize​(org.glassfish.grizzly.http.util.DataChunk uriDC)
      Normalize URI.
      protected boolean postParseRequest​(org.glassfish.grizzly.http.server.Request req, Request request, org.glassfish.grizzly.http.server.Response res, Response response, boolean v3Enabled)
      Parse additional request parameters.
      void service​(org.glassfish.grizzly.http.server.Request req, org.glassfish.grizzly.http.server.Response res)
      Service method.
      void setCompatWithTomcat​(boolean compatWithTomcat)
      true if this class needs to be compatible with Tomcat Adapter class.
      • Methods inherited from class org.glassfish.grizzly.http.server.HttpHandler

        destroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePaths
    • Field Detail

      • ALLOW_BACKSLASH

        protected static final boolean ALLOW_BACKSLASH
      • MAPPING_DATA

        protected static final org.glassfish.grizzly.http.Note<org.glassfish.grizzly.http.server.util.MappingData> MAPPING_DATA
    • 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

      • service

        public void service​(org.glassfish.grizzly.http.server.Request req,
                            org.glassfish.grizzly.http.server.Response res)
                     throws Exception
        Service method.
        Specified by:
        service in class org.glassfish.grizzly.http.server.HttpHandler
        Throws:
        Exception
      • postParseRequest

        protected boolean postParseRequest​(org.glassfish.grizzly.http.server.Request req,
                                           Request request,
                                           org.glassfish.grizzly.http.server.Response res,
                                           Response response,
                                           boolean v3Enabled)
                                    throws Exception
        Parse additional request parameters.
        Throws:
        Exception
      • normalize

        public static void normalize​(org.glassfish.grizzly.http.util.DataChunk uriDC)
                              throws IOException
        Normalize URI.

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

        Parameters:
        uriDC - URI DataChunk to be normalized
        Throws:
        IOException
      • 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.
      • log

        protected void log​(String message)
        Log a message on the Logger associated with our Container (if any)
        Parameters:
        message - Message to be logged
      • log

        protected void log​(String message,
                           Throwable throwable)
        Log a message on the Logger associated with our Container (if any)
        Parameters:
        message - Message to be logged
        throwable - Associated exception
      • fireAdapterEvent

        public void fireAdapterEvent​(String type,
                                     Object data)
        Notify all container event listeners that a particular event has occurred for this Adapter. The default implementation performs this notification synchronously using the calling thread.
        Parameters:
        type - Event type
        data - Event data
      • isCompatWithTomcat

        public boolean isCompatWithTomcat()
        Return true when an instance is executed the same way it does in Tomcat.
      • setCompatWithTomcat

        public void setCompatWithTomcat​(boolean compatWithTomcat)
        true if this class needs to be compatible with Tomcat Adapter class. Since Tomcat Adapter implementation doesn't support the afterService method, the afterService method must be invoked inside the service method.
      • getPort

        public int getPort()
        Gets the port of this CoyoteAdapter.
        Returns:
        the port of this CoyoteAdapter