Package org.glassfish.grizzly.http.ajp
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddShutdownHandler(ShutdownHandler handler) Add theShutdownHandler, which will be called, when shutdown request received.voidconfigure(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.NextActionhandleEvent(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.NextActionhandleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) Handle the Ajp message.org.glassfish.grizzly.filterchain.NextActionhandleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx) Encoding HttpResponsePacket or HttpContent to Ajp message.booleanIf set to true, the authentication will be done in Grizzly.voidremoveShutdownHandler(ShutdownHandler handler) Remove theShutdownHandler.voidIf not null, only requests from workers with this secret keyword will be accepted.voidsetTomcatAuthentication(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
-
Constructor Details
-
AjpHandlerFilter
public AjpHandlerFilter()
-
-
Method Details
-
configure
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
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
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
Add theShutdownHandler, which will be called, when shutdown request received.- Parameters:
handler-ShutdownHandler
-
removeShutdownHandler
Remove theShutdownHandler.- 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:
handleReadin interfaceorg.glassfish.grizzly.filterchain.Filter- Overrides:
handleReadin classorg.glassfish.grizzly.filterchain.BaseFilter- Parameters:
ctx- theFilterChainContextfor the currentFilterChaininvocation.- 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:
handleWritein interfaceorg.glassfish.grizzly.filterchain.Filter- Overrides:
handleWritein classorg.glassfish.grizzly.filterchain.BaseFilter- Parameters:
ctx- theFilterChainContextfor the currentFilterChaininvocation.- 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:
handleEventin interfaceorg.glassfish.grizzly.filterchain.Filter- Overrides:
handleEventin classorg.glassfish.grizzly.filterchain.BaseFilter- Parameters:
ctx- theFilterChainContextfor the currentFilterChaininvocation.event- the event triggering the invocation of this method.- Returns:
- the
NextAction. - Throws:
IOException- if an I/O error occurs.
-