Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http.server

public Class HttpServerFilter

extends BaseFilter
implements MonitoringAware<HttpServerProbe>
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.monitoring.MonitoringAware
Imports
java.io.IOException, java.util.concurrent.Callable, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, .AtomicReference, java.util.logging.Level, .Logger, org.glassfish.grizzly.CompletionHandler, .Connection, .EmptyCompletionHandler, .Grizzly, .ReadHandler, org.glassfish.grizzly.attributes.Attribute, org.glassfish.grizzly.filterchain.BaseFilter, .Filter, .FilterChainContext, .FilterChainEvent, .NextAction, .ShutdownEvent, .TransportFilter, org.glassfish.grizzly.http.HttpContent, .HttpContext, .HttpPacket, .HttpRequestPacket, .HttpResponsePacket, .Method, org.glassfish.grizzly.http.server.util.HtmlHelper, org.glassfish.grizzly.http.util.Header, .HttpStatus, org.glassfish.grizzly.impl.FutureImpl, org.glassfish.grizzly.localization.LogMessages, org.glassfish.grizzly.monitoring.DefaultMonitoringConfig, .MonitoringAware, .MonitoringConfig, .MonitoringUtils, org.glassfish.grizzly.utils.DelayedExecutor, .Futures

Filter implementation to provide high-level HTTP request/response processing.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
HttpServerFilter.FlushResponseHandler

The CompletionHandler to be used to make sure the response data have been flushed.

Field Summary

Modifier and TypeField and Description
private final AtomicInteger
activeRequestsCounter

The number of requests, which are currently in process.

private final ServerFilterConfiguration
config

Server configuration

private final HttpServerFilter.FlushResponseHandler
flushResponseHandler

The CompletionHandler to be used to make sure the response data have been flushed

private volatile HttpHandler
private final Attribute<Request>
httpRequestInProgress

Attribute, which holds the current HTTP Request in progress associated with an HttpContext

private static final Logger
protected final DefaultMonitoringConfig<HttpServerProbe>
monitoringConfig

Web server probes

private AtomicReference<FutureImpl<HttpServerFilter>>
shutdownCompletionFuture

CompletionHandler to be notified, when shutdown could be gracefully completed

private AtomicBoolean
shuttingDown

The flag, which indicates if the server is currently in the shutdown phase

private final DelayedExecutor.DelayQueue<Response.SuspendTimeout>
suspendedResponseQueue

Delay queue to control suspended request/response processing timeouts

Constructor Summary

AccessConstructor and Description
public
HttpServerFilter(final ServerFilterConfiguration config, final DelayedExecutor delayedExecutor)

Method Summary

Modifier and TypeMethod and Description
private NextAction
afterService(final FilterChainContext ctx, final Connection<L> connection, final Request request, final Response response)

private boolean
checkMaxPostSize(final long requestContentLength)

Returns: true if request content-length doesn't exceed the max post size limit, or false otherwise

protected Object
public void
exceptionOccurred(final FilterChainContext
event processing FilterChainContext
ctx
,
final Throwable
error, which occurred during FilterChain execution
error
)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.exceptionOccurred.

Implements org.glassfish.grizzly.filterchain.Filter.exceptionOccurred.

Override the default implementation to notify the ReadHandler, if available, of any read error that has occurred during processing.

public ServerFilterConfiguration
protected String
public HttpHandler
public MonitoringConfig<HttpServerProbe>
public NextAction
public NextAction
handleRead(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading.

private void
onRequestCompleteAndResponseFlushed()

Will be called, once HTTP request processing is complete and response is flushed.

protected void
onTraceRequest(final Request request, final Response response)

public void
setHttpHandler(final HttpHandler httpHandler)

Inherited from org.glassfish.grizzly.filterchain.BaseFilter:
createContexthandleAccepthandleClosehandleConnecthandleWriteonAddedonFilterChainChangedonRemovedtoString

Field Detail

activeRequestsCounterback to summary
private final AtomicInteger activeRequestsCounter

The number of requests, which are currently in process.

configback to summary
private final ServerFilterConfiguration config

Server configuration

flushResponseHandlerback to summary
private final HttpServerFilter.FlushResponseHandler flushResponseHandler

The CompletionHandler to be used to make sure the response data have been flushed

httpHandlerback to summary
private volatile HttpHandler httpHandler

Root HttpHandler

httpRequestInProgressback to summary
private final Attribute<Request> httpRequestInProgress

Attribute, which holds the current HTTP Request in progress associated with an HttpContext

LOGGERback to summary
private static final Logger LOGGER
monitoringConfigback to summary
protected final DefaultMonitoringConfig<HttpServerProbe> monitoringConfig

Web server probes

shutdownCompletionFutureback to summary
private AtomicReference<FutureImpl<HttpServerFilter>> shutdownCompletionFuture

CompletionHandler to be notified, when shutdown could be gracefully completed

shuttingDownback to summary
private AtomicBoolean shuttingDown

The flag, which indicates if the server is currently in the shutdown phase

suspendedResponseQueueback to summary
private final DelayedExecutor.DelayQueue<Response.SuspendTimeout> suspendedResponseQueue

Delay queue to control suspended request/response processing timeouts

Constructor Detail

HttpServerFilterback to summary
public HttpServerFilter(final ServerFilterConfiguration config, final DelayedExecutor delayedExecutor)

Method Detail

afterServiceback to summary
private NextAction afterService(final FilterChainContext ctx, final Connection<L> connection, final Request request, final Response response) throws IOException
checkMaxPostSizeback to summary
private boolean checkMaxPostSize(final long requestContentLength)
Returns:boolean

true if request content-length doesn't exceed the max post size limit, or false otherwise

createJmxManagementObjectback to summary
protected Object createJmxManagementObject()
exceptionOccurredback to summary
public void exceptionOccurred(final FilterChainContext ctx, final Throwable error)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.exceptionOccurred.

Implements org.glassfish.grizzly.filterchain.Filter.exceptionOccurred.

Override the default implementation to notify the ReadHandler, if available, of any read error that has occurred during processing.

Parameters
ctx:FilterChainContext

event processing FilterChainContext

error:Throwable

error, which occurred during FilterChain execution

Annotations
@Override
getConfigurationback to summary
public ServerFilterConfiguration getConfiguration()
getFullServerNameback to summary
protected String getFullServerName()
getHttpHandlerback to summary
public HttpHandler getHttpHandler()
Annotations
@SuppressWarnings:UnusedDeclaration
getMonitoringConfigback to summary
public MonitoringConfig<HttpServerProbe> getMonitoringConfig()

Implements org.glassfish.grizzly.monitoring.MonitoringAware.getMonitoringConfig.

Doc from org.glassfish.grizzly.monitoring.MonitoringAware.getMonitoringConfig.

Return the object associated MonitoringConfig.

Annotations
@Override
handleEventback to summary
public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleEvent.

Implements org.glassfish.grizzly.filterchain.Filter.handleEvent.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleEvent.

Handle custom event associated with the Connection. This Filter may either complete the required processing and return StopAction, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning InvokeAction.

Annotations
@Override
handleReadback to summary
public NextAction handleRead(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Annotations
@SuppressWarnings:unchecked, ReturnInsideFinallyBlock
@Override
onRequestCompleteAndResponseFlushedback to summary
private void onRequestCompleteAndResponseFlushed()

Will be called, once HTTP request processing is complete and response is flushed.

onTraceRequestback to summary
protected void onTraceRequest(final Request request, final Response response) throws IOException
setHttpHandlerback to summary
public void setHttpHandler(final HttpHandler httpHandler)
org.glassfish.grizzly.http.server back to summary

private final Class HttpServerFilter.FlushResponseHandler

extends EmptyCompletionHandler<Object>
implements AfterServiceListener
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.http.server.AfterServiceListener

The CompletionHandler to be used to make sure the response data have been flushed.

Field Summary

Modifier and TypeField and Description
private final FilterChainEvent

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
onAfterService(final Request request)

Implements org.glassfish.grizzly.http.server.AfterServiceListener.onAfterService.

The method will be called once the Request processing will be completed.

Inherited from org.glassfish.grizzly.EmptyCompletionHandler:
updated

Field Detail

eventback to summary
private final FilterChainEvent event

Constructor Detail

FlushResponseHandlerback to summary
private FlushResponseHandler()

Method Detail

cancelledback to summary
public void cancelled()

Overrides org.glassfish.grizzly.EmptyCompletionHandler.cancelled.

Implements org.glassfish.grizzly.CompletionHandler.cancelled.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.cancelled.

The operation was cancelled.

Annotations
@Override
completedback to summary
public void completed(final Object result)

Overrides org.glassfish.grizzly.EmptyCompletionHandler.completed.

Implements org.glassfish.grizzly.CompletionHandler.completed.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.completed.

The operation was completed.

Annotations
@Override
failedback to summary
public void failed(final Throwable throwable)

Overrides org.glassfish.grizzly.EmptyCompletionHandler.failed.

Implements org.glassfish.grizzly.CompletionHandler.failed.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.failed.

The operation was failed.

Annotations
@Override
onAfterServiceback to summary
public void onAfterService(final Request request)

Implements org.glassfish.grizzly.http.server.AfterServiceListener.onAfterService.

Doc from org.glassfish.grizzly.http.server.AfterServiceListener.onAfterService.

The method will be called once the Request processing will be completed.

Annotations
@Override