Class AjpHandlerFilter

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

public class AjpHandlerFilter extends org.glassfish.grizzly.filterchain.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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add the ShutdownHandler, which will be called, when shutdown request received.
    void
    configure(Properties properties)
    Configure Ajp Filter using properties.
    If not null, only requests from workers with this secret keyword will be accepted.
    org.glassfish.grizzly.filterchain.NextAction
    handleEvent(org.glassfish.grizzly.filterchain.FilterChainContext ctx, org.glassfish.grizzly.filterchain.FilterChainEvent event)
    Handling Http request completion event sent by Http server filter and send the Ajp end response message.
    org.glassfish.grizzly.filterchain.NextAction
    handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
    Handle the Ajp message.
    org.glassfish.grizzly.filterchain.NextAction
    handleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
    Encoding HttpResponsePacket or HttpContent to Ajp message.
    boolean
    If set to true, the authentication will be done in Grizzly.
    void
    Remove the ShutdownHandler.
    void
    setSecret(String requiredSecret)
    If not null, only requests from workers with this secret keyword will be accepted.
    void
    setTomcatAuthentication(boolean isTomcatAuthentication)
    /** If set to true, the authentication will be done in Grizzly.

    Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter

    createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, onAdded, onFilterChainChanged, onRemoved, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 org.glassfish.grizzly.filterchain.NextAction handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) throws IOException
      Handle the Ajp message.
      Specified by:
      handleRead in interface org.glassfish.grizzly.filterchain.Filter
      Overrides:
      handleRead in class org.glassfish.grizzly.filterchain.BaseFilter
      Parameters:
      ctx - the FilterChainContext for the current FilterChain invocation.
      Returns:
      the NextAction
      Throws:
      IOException - if an I/O error occurs
    • handleWrite

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

      public org.glassfish.grizzly.filterchain.NextAction handleEvent(org.glassfish.grizzly.filterchain.FilterChainContext ctx, org.glassfish.grizzly.filterchain.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 org.glassfish.grizzly.filterchain.Filter
      Overrides:
      handleEvent in class org.glassfish.grizzly.filterchain.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.