public class SpdyHandlerFilter extends HttpBaseFilter
Filter
serves as a bridge
between SPDY and HTTP layers by converting SpdyFrame
s into
HttpPacket
s 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,
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.
|
NextAction |
handleConnect(FilterChainContext ctx)
Execute a unit of processing work to be performed, when channel gets
connected.
|
NextAction |
handleEvent(FilterChainContext ctx,
FilterChainEvent event)
Handle custom event associated with the
Connection . |
NextAction |
handleRead(FilterChainContext ctx)
Execute a unit of processing work to be performed, when channel will
become available for reading.
|
NextAction |
handleWrite(FilterChainContext ctx)
Execute a unit of processing work to be performed, when some data should
be written on channel.
|
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 |
onHttpContentError(HttpHeader httpHeader,
FilterChainContext ctx,
Throwable t)
Callback which is invoked when parsing an HTTP message payload fails.
|
protected void |
onHttpContentParsed(HttpContent content,
FilterChainContext ctx)
Invoked as request/response body content has been processed by this
Filter . |
protected void |
onHttpHeaderError(HttpHeader httpHeader,
FilterChainContext ctx,
Throwable t)
Callback which is invoked when parsing an HTTP message header 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 httpHeader,
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 |
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.
|
bind
createContext, exceptionOccurred, handleAccept, handleClose, onAdded, onFilterChainChanged, onRemoved
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 NextAction handleRead(FilterChainContext ctx) throws IOException
BaseFilter
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.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
protected boolean onHttpPacketParsed(HttpHeader httpHeader, 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(HttpHeader httpHeader, Buffer buffer, 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(HttpHeader httpHeader, 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(HttpHeader httpHeader, 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(HttpHeader httpHeader, 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(HttpHeader httpHeader, 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(HttpContent content, FilterChainContext ctx)
Invoked as request/response body content has been processed by this
Filter
.
content
- request/response body contentctx
- processing context.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.
content
- HttpContent
, which represents HTTP packet headerctx
- processing context.protected void onHttpHeaderError(HttpHeader httpHeader, 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 errorIOException
protected void onHttpContentError(HttpHeader httpHeader, 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 errorIOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
BaseFilter
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.handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleConnect(FilterChainContext ctx) throws IOException
BaseFilter
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.handleConnect
in interface Filter
handleConnect
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
BaseFilter
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
.handleEvent
in interface Filter
handleEvent
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
protected org.glassfish.grizzly.npn.ClientSideNegotiator getClientNpnNegotioator()
protected SpdySession createSpdySession(SpdyVersion spdyVersion, Connection connection, boolean isServer)
SpdySession
with preconfigured initial-windows-size and
max-concurrent-spdyVersion
- connection
- isServer
- Copyright © 2015 Oracle Corporation. All rights reserved.