|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.http.HttpCodecFilter
org.glassfish.grizzly.http.HttpServerFilter
public class HttpServerFilter
Server side HttpCodecFilter implementation, which is responsible for
decoding HttpRequestPacket and encoding HttpResponsePacket messages.
This Filter is usually used, when we build an asynchronous HTTP server
connection.
HttpCodecFilter,
HttpClientFilter| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.glassfish.grizzly.http.HttpCodecFilter |
|---|
HttpCodecFilter.ContentParsingState, HttpCodecFilter.HeaderParsingState |
| Field Summary | |
|---|---|
static java.lang.String |
HTTP_SERVER_REQUEST_ATTR_NAME
|
static FilterChainEvent |
RESPONSE_COMPLETE_EVENT
|
| Fields inherited from class org.glassfish.grizzly.http.HttpCodecFilter |
|---|
chunkingEnabled, contentEncodings, DEFAULT_MAX_HTTP_PACKET_HEADER_SIZE, maxHeadersSize, monitoringConfig |
| Constructor Summary | |
|---|---|
HttpServerFilter()
Constructor, which creates HttpServerFilter instance |
|
HttpServerFilter(boolean chunkingEnabled,
int maxHeadersSize,
KeepAlive keepAlive,
DelayedExecutor executor)
Constructor, which creates HttpServerFilter instance, with the specific max header size parameter. |
|
HttpServerFilter(boolean chunkingEnabled,
int maxHeadersSize,
java.lang.String defaultResponseContentType,
KeepAlive keepAlive,
DelayedExecutor executor)
Constructor, which creates HttpServerFilter instance, with the specific max header size parameter. |
|
| Method Summary | |
|---|---|
protected HttpContent |
customizeErrorResponse(HttpResponsePacket response)
|
protected Buffer |
encodeHttpPacket(FilterChainContext ctx,
HttpPacket input)
|
java.lang.String |
getDefaultResponseContentType()
|
NextAction |
handleEvent(FilterChainContext ctx,
FilterChainEvent event)
|
NextAction |
handleRead(FilterChainContext ctx)
The method is called, once we have received a Buffer,
which has to be transformed into HTTP request packet part. |
boolean |
isAuthPassthroughEnabled()
|
boolean |
isTraceEnabled()
|
protected void |
onHttpContentEncoded(HttpContent content,
FilterChainContext ctx)
Invoked when a HTTP body chunk has been encoded in preparation to being transmitted to the user-agent. |
protected void |
onHttpContentParsed(HttpContent content,
FilterChainContext ctx)
Invoked as request/response body content has been processed by this Filter. |
protected void |
onHttpError(HttpHeader httpHeader,
FilterChainContext ctx)
Callback which is invoked when parsing an HTTP message fails. |
protected boolean |
onHttpHeaderParsed(HttpHeader httpHeader,
Buffer buffer,
FilterChainContext ctx)
Callback invoked when the HTTP message header parsing is complete. |
protected void |
onHttpHeadersEncoded(HttpHeader httpHeader,
FilterChainContext ctx)
Invoked when HTTP headers have been encoded in preparation to being transmitted to the user-agent. |
protected void |
onHttpHeadersParsed(HttpHeader httpHeader,
FilterChainContext ctx)
Invoked when all headers of the packet have been parsed. |
protected boolean |
onHttpPacketParsed(HttpHeader httpHeader,
FilterChainContext ctx)
Callback method, called when HttpPacket parsing has been completed. |
protected void |
onInitialLineEncoded(HttpHeader header,
FilterChainContext ctx)
Invoked when the intial response line has been encoded in preparation to being transmitted to the user-agent. |
protected void |
onInitialLineParsed(HttpHeader httpHeader,
FilterChainContext ctx)
Invoked when either the request line or status line has been parsed. |
void |
setAuthPassthroughEnabled(boolean enabled)
|
void |
setDefaultResponseContentType(java.lang.String defaultResponseContentType)
|
void |
setTraceEnabled(boolean enabled)
|
| Methods inherited from class org.glassfish.grizzly.http.HttpCodecFilter |
|---|
addContentEncoding, addTransferEncoding, checkEOL, createJmxManagementObject, decodeHttpPacket, encodeKnownHeaders, encodeMimeHeader, encodeMimeHeaders, findEOL, findSpace, getContentEncodings, getMonitoringConfig, getTransferEncodings, handleRead, handleWrite, indexOf, isChunkingEnabled, isSecure, parseHeader, parseHeaderName, parseHeaders, parseHeaderValue, removeContentEncoding, removeTransferEncoding, skipSpaces |
| Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter |
|---|
createContext, exceptionOccurred, getFilterChain, getIndex, handleAccept, handleClose, handleConnect, onAdded, onFilterChainChanged, onRemoved |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String HTTP_SERVER_REQUEST_ATTR_NAME
public static final FilterChainEvent RESPONSE_COMPLETE_EVENT
| Constructor Detail |
|---|
public HttpServerFilter()
public HttpServerFilter(boolean chunkingEnabled,
int maxHeadersSize,
KeepAlive keepAlive,
DelayedExecutor executor)
chunkingEnabled - flag indicating whether or not chunking should
be allowed or not.maxHeadersSize - the maximum size of an inbound HTTP message header.keepAlive - keep-alive configuration for this filter instance.executor - DelayedExecutor for handling keep-alive.
public HttpServerFilter(boolean chunkingEnabled,
int maxHeadersSize,
java.lang.String defaultResponseContentType,
KeepAlive keepAlive,
DelayedExecutor executor)
chunkingEnabled - flag indicating whether or not chunking should
be allowed or not.maxHeadersSize - the maximum size of an inbound HTTP message header.defaultResponseContentType - the content type that the response should
use if no content had been specified at the time the response is committed.keepAlive - keep-alive configuration for this filter instance.executor - DelayedExecutor for handling keep-alive. If null -
keep-alive idle connections should be managed outside HttpServerFilter.| Method Detail |
|---|
public NextAction handleRead(FilterChainContext ctx)
throws java.io.IOException
Buffer,
which has to be transformed into HTTP request packet part.
Filter gets Buffer, which represents a part or complete HTTP
request message. As the result of "read" transformation - we will get
HttpContent message, which will represent HTTP request packet
content (might be zero length content) and reference
to a HttpHeader, which contains HTTP request message header.
handleRead in interface FilterhandleRead in class BaseFilterctx - Request processing context
NextAction
java.io.IOException
public NextAction handleEvent(FilterChainContext ctx,
FilterChainEvent event)
throws java.io.IOException
handleEvent in interface FilterhandleEvent in class BaseFilterjava.io.IOException
protected boolean onHttpHeaderParsed(HttpHeader httpHeader,
Buffer buffer,
FilterChainContext ctx)
HttpCodecFilter
onHttpHeaderParsed in class HttpCodecFilterhttpHeader - HttpHeader, which represents parsed HTTP packet headerbuffer - Buffer the header was parsed fromctx - processing context.
true if an error has occurred while processing
the header portion of the HTTP request, otherwise returns
false.
protected final boolean onHttpPacketParsed(HttpHeader httpHeader,
FilterChainContext ctx)
HttpCodecFilterHttpPacket parsing has been completed.
onHttpPacketParsed in class HttpCodecFilterhttpHeader - HttpHeader, which represents parsed HTTP packet headerctx - processing context.
true if an error has occurred while processing
the header portion of the HTTP request, otherwise returns
false.s
protected void onInitialLineParsed(HttpHeader httpHeader,
FilterChainContext ctx)
HttpCodecFilterInvoked when either the request line or status line has been parsed.
onInitialLineParsed in class HttpCodecFilterhttpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.
protected void onInitialLineEncoded(HttpHeader header,
FilterChainContext ctx)
HttpCodecFilterInvoked when the intial response line has been encoded in preparation to being transmitted to the user-agent.
onInitialLineEncoded in class HttpCodecFilterheader - HttpHeader, which represents HTTP packet headerctx - processing context.
protected void onHttpHeadersParsed(HttpHeader httpHeader,
FilterChainContext ctx)
HttpCodecFilterInvoked when all headers of the packet have been parsed. Depending on the transfer encoding being used by the current request, this method may be invoked multiple times.
onHttpHeadersParsed in class HttpCodecFilterhttpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.
protected void onHttpHeadersEncoded(HttpHeader httpHeader,
FilterChainContext ctx)
HttpCodecFilterInvoked when HTTP headers have been encoded in preparation to being transmitted to the user-agent.
onHttpHeadersEncoded in class HttpCodecFilterhttpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.
protected void onHttpContentParsed(HttpContent content,
FilterChainContext ctx)
HttpCodecFilter
Invoked as request/response body content has been processed by this
Filter.
onHttpContentParsed in class HttpCodecFiltercontent - request/response body contentctx - processing context.
protected void onHttpContentEncoded(HttpContent content,
FilterChainContext ctx)
HttpCodecFilterInvoked when a HTTP body chunk has been encoded in preparation to being transmitted to the user-agent.
onHttpContentEncoded in class HttpCodecFiltercontent - HttpContent, which represents HTTP packet headerctx - processing context.
protected void onHttpError(HttpHeader httpHeader,
FilterChainContext ctx)
throws java.io.IOException
HttpCodecFilterCallback which is invoked when parsing an HTTP message fails. The processing logic has to take care about error handling and following connection closing.
onHttpError in class HttpCodecFilterhttpHeader - HttpHeader, which represents HTTP packet headerctx - the FilterChainContext processing this request
java.io.IOException
protected Buffer encodeHttpPacket(FilterChainContext ctx,
HttpPacket input)
encodeHttpPacket in class HttpCodecFilterprotected HttpContent customizeErrorResponse(HttpResponsePacket response)
public boolean isAuthPassthroughEnabled()
public void setAuthPassthroughEnabled(boolean enabled)
public boolean isTraceEnabled()
public void setTraceEnabled(boolean enabled)
public java.lang.String getDefaultResponseContentType()
public void setDefaultResponseContentType(java.lang.String defaultResponseContentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||