public class SpdyHandlerFilter
extends org.glassfish.grizzly.http.HttpBaseFilter
Filter serves as a bridge
between SPDY and HTTP layers by converting SpdyFrames into
HttpPackets and passing them up/down by the FilterChain.
Additionally this Filter has
logic responsible for checking SPDY protocol semantics and fire correspondent
events and messages in case when SPDY semantics is broken.| Constructor and Description |
|---|
SpdyHandlerFilter(SpdyMode spdyMode)
Constructs SpdyHandlerFilter.
|
SpdyHandlerFilter(SpdyMode spdyMode,
ExecutorService threadPool,
SpdyVersion... supportedSpdyVersions)
Constructs SpdyHandlerFilter.
|
SpdyHandlerFilter(SpdyMode spdyMode,
SpdyVersion... supportedSpdyVersions)
Constructs SpdyHandlerFilter.
|
| Modifier and Type | Method and Description |
|---|---|
protected SpdySession |
createSpdySession(SpdyVersion spdyVersion,
org.glassfish.grizzly.Connection connection,
boolean isServer)
Creates
SpdySession with preconfigured initial-windows-size and
max-concurrent- |
protected org.glassfish.grizzly.npn.ClientSideNegotiator |
getClientNpnNegotioator()
Returns the client NPN negotiator to be used if this filter is used in
the client-side filter chain.
|
int |
getInitialWindowSize()
Returns the default initial stream window size (in bytes) for new SPDY sessions.
|
int |
getMaxConcurrentStreams()
Returns the default maximum number of concurrent streams allowed for one session.
|
org.glassfish.grizzly.filterchain.NextAction |
handleConnect(org.glassfish.grizzly.filterchain.FilterChainContext ctx) |
org.glassfish.grizzly.filterchain.NextAction |
handleEvent(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.filterchain.FilterChainEvent event) |
org.glassfish.grizzly.filterchain.NextAction |
handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) |
org.glassfish.grizzly.filterchain.NextAction |
handleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx) |
protected void |
onHttpContentEncoded(org.glassfish.grizzly.http.HttpContent content,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when a HTTP body chunk has been encoded in preparation to being
transmitted to the user-agent.
|
protected void |
onHttpContentError(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx,
Throwable t)
Callback which is invoked when parsing an HTTP message payload fails.
|
protected void |
onHttpContentParsed(org.glassfish.grizzly.http.HttpContent content,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked as request/response body content has been processed by this
Filter. |
protected void |
onHttpHeaderError(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx,
Throwable t)
Callback which is invoked when parsing an HTTP message header fails.
|
protected boolean |
onHttpHeaderParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.Buffer buffer,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Callback invoked when the HTTP message header parsing is complete.
|
protected void |
onHttpHeadersEncoded(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when HTTP headers have been encoded in preparation to being
transmitted to the user-agent.
|
protected void |
onHttpHeadersParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when all headers of the packet have been parsed.
|
protected boolean |
onHttpPacketParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Callback method, called when
HttpPacket parsing has been completed. |
protected void |
onInitialLineEncoded(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when the intial response line has been encoded in preparation
to being transmitted to the user-agent.
|
protected void |
onInitialLineParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when either the request line or status line has been parsed.
|
void |
setInitialWindowSize(int initialWindowSize)
Sets the default initial stream window size (in bytes) for new SPDY sessions.
|
void |
setMaxConcurrentStreams(int maxConcurrentStreams)
Sets the default maximum number of concurrent streams allowed for one session.
|
public SpdyHandlerFilter(SpdyMode spdyMode)
spdyMode - the SpdyMode.public SpdyHandlerFilter(SpdyMode spdyMode, SpdyVersion... supportedSpdyVersions)
spdyMode - the SpdyMode.supportedSpdyVersions - SPDY versions this filter has to supportpublic SpdyHandlerFilter(SpdyMode spdyMode, ExecutorService threadPool, SpdyVersion... supportedSpdyVersions)
spdyMode - the SpdyMode.threadPool - the ExecutorService to be used to process SynStreamFrame and
SynReplyFrame frames, if null mentioned frames will be processed in the same thread they were parsed.supportedSpdyVersions - SPDY versions this filter has to supportpublic void setMaxConcurrentStreams(int maxConcurrentStreams)
public int getMaxConcurrentStreams()
public void setInitialWindowSize(int initialWindowSize)
public int getInitialWindowSize()
public org.glassfish.grizzly.filterchain.NextAction handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
throws IOException
handleRead in interface org.glassfish.grizzly.filterchain.FilterhandleRead in class org.glassfish.grizzly.filterchain.BaseFilterIOExceptionprotected boolean onHttpPacketParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
HttpPacket parsing has been completed.httpHeader - 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.protected boolean onHttpHeaderParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.Buffer buffer,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
httpHeader - 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 void onInitialLineParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when either the request line or status line has been parsed.
httpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.protected void onInitialLineEncoded(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when the intial response line has been encoded in preparation to being transmitted to the user-agent.
httpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.protected void onHttpHeadersParsed(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked 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.
httpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.protected void onHttpHeadersEncoded(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when HTTP headers have been encoded in preparation to being transmitted to the user-agent.
httpHeader - HttpHeader, which represents HTTP packet headerctx - processing context.protected void onHttpContentParsed(org.glassfish.grizzly.http.HttpContent content,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked as request/response body content has been processed by this
Filter.
content - request/response body contentctx - processing context.protected void onHttpContentEncoded(org.glassfish.grizzly.http.HttpContent content,
org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Invoked when a HTTP body chunk has been encoded in preparation to being transmitted to the user-agent.
content - HttpContent, which represents HTTP packet headerctx - processing context.protected void onHttpHeaderError(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx,
Throwable t)
throws IOException
Callback which is invoked when parsing an HTTP message header fails. The processing logic has to take care about error handling and following connection closing.
httpHeader - HttpHeader, which represents HTTP packet headerctx - the FilterChainContext processing this requestt - the cause of the errorIOExceptionprotected void onHttpContentError(org.glassfish.grizzly.http.HttpHeader httpHeader,
org.glassfish.grizzly.filterchain.FilterChainContext ctx,
Throwable t)
throws IOException
Callback which is invoked when parsing an HTTP message payload fails. The processing logic has to take care about error handling and following connection closing.
httpHeader - HttpHeader, which represents HTTP packet headerctx - the FilterChainContext processing this requestt - the cause of the errorIOExceptionpublic org.glassfish.grizzly.filterchain.NextAction handleWrite(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
throws IOException
handleWrite in interface org.glassfish.grizzly.filterchain.FilterhandleWrite in class org.glassfish.grizzly.filterchain.BaseFilterIOExceptionpublic org.glassfish.grizzly.filterchain.NextAction handleConnect(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
throws IOException
handleConnect in interface org.glassfish.grizzly.filterchain.FilterhandleConnect in class org.glassfish.grizzly.filterchain.BaseFilterIOExceptionpublic org.glassfish.grizzly.filterchain.NextAction handleEvent(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.filterchain.FilterChainEvent event)
throws IOException
handleEvent in interface org.glassfish.grizzly.filterchain.FilterhandleEvent in class org.glassfish.grizzly.filterchain.BaseFilterIOExceptionprotected org.glassfish.grizzly.npn.ClientSideNegotiator getClientNpnNegotioator()
protected SpdySession createSpdySession(SpdyVersion spdyVersion, org.glassfish.grizzly.Connection connection, boolean isServer)
SpdySession with preconfigured initial-windows-size and
max-concurrent-spdyVersion - connection - isServer - Copyright © 2019 Oracle Corporation. All Rights Reserved.