Class AjpHandlerFilter

java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.http.ajp.AjpHandlerFilter
All Implemented Interfaces:
Filter

public class AjpHandlerFilter extends BaseFilter
Filter is working as Codec between Ajp and Http packets. In other words it's responsible for decoding Ajp message to HttpRequestPacket, and encoding HttpResponsePacket to Ajp message back.
Author:
Alexey Stashok
  • Constructor Details

    • AjpHandlerFilter

      public AjpHandlerFilter()
  • Method Details

    • configure

      public void configure(Properties properties)
      Configure Ajp Filter using properties. We support following properties: request.useSecret, request.secret, tomcatAuthentication.
      Parameters:
      properties -
    • isTomcatAuthentication

      public boolean isTomcatAuthentication()
      If set to true, the authentication will be done in Grizzly. Otherwise, the authenticated principal will be propagated from the native webserver and used for authorization in Grizzly. The default value is true.
      Returns:
      true, if the authentication will be done in Grizzly. Otherwise, the authenticated principal will be propagated from the native webserver and used for authorization in Grizzly.
    • setTomcatAuthentication

      public void setTomcatAuthentication(boolean isTomcatAuthentication)
      /** If set to true, the authentication will be done in Grizzly. Otherwise, the authenticated principal will be propagated from the native webserver and used for authorization in Grizzly. The default value is true.
      Parameters:
      isTomcatAuthentication - if true, the authentication will be done in Grizzly. Otherwise, the authenticated principal will be propagated from the native webserver and used for authorization in Grizzly.
    • getSecret

      public String getSecret()
      If not null, only requests from workers with this secret keyword will be accepted.
      Returns:
      not null, if only requests from workers with this secret keyword will be accepted, or null otherwise.
    • setSecret

      public void setSecret(String requiredSecret)
      If not null, only requests from workers with this secret keyword will be accepted.
      Parameters:
      requiredSecret - if not null, only requests from workers with this secret keyword will be accepted.
    • addShutdownHandler

      public void addShutdownHandler(ShutdownHandler handler)
      Add the ShutdownHandler, which will be called, when shutdown request received.
      Parameters:
      handler - ShutdownHandler
    • removeShutdownHandler

      public void removeShutdownHandler(ShutdownHandler handler)
      Remove the ShutdownHandler.
      Parameters:
      handler - ShutdownHandler
    • handleRead

      public NextAction handleRead(FilterChainContext ctx) throws IOException
      Handle the Ajp message.
      Specified by:
      handleRead in interface Filter
      Overrides:
      handleRead in class BaseFilter
      Parameters:
      ctx - the FilterChainContext for the current FilterChain invocation.
      Returns:
      the NextAction
      Throws:
      IOException - if an I/O error occurs
    • handleWrite

      public NextAction handleWrite(FilterChainContext ctx) throws IOException
      Encoding HttpResponsePacket or HttpContent to Ajp message.
      Specified by:
      handleWrite in interface Filter
      Overrides:
      handleWrite in class BaseFilter
      Parameters:
      ctx - the FilterChainContext for the current FilterChain invocation.
      Returns:
      the NextAction
      Throws:
      IOException - if an I/O error occurs
    • handleEvent

      public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
      Handling Http request completion event sent by Http server filter and send the Ajp end response message.
      Specified by:
      handleEvent in interface Filter
      Overrides:
      handleEvent in class BaseFilter
      Parameters:
      ctx - the FilterChainContext for the current FilterChain invocation.
      event - the event triggering the invocation of this method.
      Returns:
      the NextAction.
      Throws:
      IOException - if an I/O error occurs.