Top Fields Constructors Methods
org.glassfish.grizzly.http2

public Class Http2ClientFilter

extends Http2BaseFilter
Class Inheritance
Static Imports
org.glassfish.grizzly.http2.Termination.IN_FIN_TERMINATION, .Termination.OUT_FIN_TERMINATION, org.glassfish.grizzly.http2.frames.SettingsFrame.SETTINGS_ENABLE_PUSH, .SettingsFrame.SETTINGS_INITIAL_WINDOW_SIZE, .SettingsFrame.SETTINGS_MAX_CONCURRENT_STREAMS

Author
oleksiys

Field Summary

Modifier and TypeField and Description
private final HeaderValue
private final AlpnClientNegotiatorImpl
private final HeaderValue
private boolean
private static final Logger
private boolean
Inherited from org.glassfish.grizzly.http2.Http2BaseFilter:
FIXED_LENGTH_ENCODINGframeCodecHTTP2_CLEARHTTP2_PUSH_ENABLEDPRI_PAYLOADthreadPool

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
checkIfLastHttp11Chunk(final FilterChainContext ctx, final Http2State http2State, final Object msg)

private static HttpResponsePacket
copyInterimResponse(final HttpRequestPacket request, final HttpResponsePacket source)

Creates a standalone copy of an interim (1xx) response so it can be delivered upstream while the shared response packet is reused for the final response.

protected Http2Session

Returns:

Http2Session
createClientHttp2Session
(final Connection<L>
the TCP connection
connection
)

Creates client-side Http2Session with pre-configured initial-windows-size and max-concurrent-streams.

protected AlpnClientNegotiator
public NextAction
handleConnect(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleConnect.

Implements org.glassfish.grizzly.filterchain.Filter.handleConnect.

Execute a unit of processing work to be performed, when channel gets connected.

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.

public NextAction
handleWrite(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.http2.Http2BaseFilter.handleWrite.

Implements org.glassfish.grizzly.filterchain.Filter.handleWrite.

Execute a unit of processing work to be performed, when some data should be written on channel.

private static boolean
public boolean
isNeverForceUpgrade()

Returns: true if an upgrade to HTTP/2 will not be performed, otherwise false

public boolean
isSendPushRequestUpstream()

Returns: true if the push request has to be sent upstream, so a user has an opportunity to process it, or false otherwise

protected SettingsFrame.SettingsFrameBuilder
prepareSettings(final Http2Session http2Session)

protected void
processCompleteHeader(final Http2Session http2Session, final FilterChainContext context, final HeaderBlockHead firstHeaderFrame)

Implements abstract org.glassfish.grizzly.http2.Http2BaseFilter.processCompleteHeader.

The method is called once complete HTTP header block arrives on Http2Session.

private void
processInPushPromise(final Http2Session http2Session, final FilterChainContext context, final PushPromiseFrame pushPromiseFrame)

private void
processInResponse(final Http2Session http2Session, final FilterChainContext context, final HeadersFrame headersFrame)

protected void
processOutgoingHttpHeader(final FilterChainContext
the current FilterChainContext
ctx
,
final Http2Session
the Http2Session that's being written to.
http2Session
,
final HttpHeader
the HttpHeader to write.
httpHeader
,
final HttpPacket
the HttpPacket to write.
entireHttpPacket
)

Implements abstract org.glassfish.grizzly.http2.Http2BaseFilter.processOutgoingHttpHeader.

Process the provided outbound header/packet.

private void
processOutgoingRequestForNewStream(final FilterChainContext ctx, final Http2Session http2Session, final HttpRequestPacket request, final HttpPacket entireHttpPacket)

public void
setNeverForceUpgrade(boolean
true to disable upgrade attempts, otherwise false
neverForceUpgrade
)

Configure this filter to completely disable attempts to upgrade to HTTP/2.

public void
setSendPushRequestUpstream(boolean
true if the push request has to be sent upstream, so a user has an opportunity to process it, or false otherwise
sendPushRequestUpstream
)

private boolean

Returns:

true if the connection was successfully upgraded, otherwise false
tryHttpUpgrade
(final FilterChainContext
the current FilterChainContext
ctx
,
final Http2State
the HTTP2 connection state
http2State
,
final HttpRequestPacket
the HTTP request
httpRequest
,
final HttpResponsePacket
the HTTP response
httpResponse
)

The method is called once a client receives an HTTP response to its initial propose to establish HTTP/2.0 connection.

private boolean
tryInsertHttpUpgradeHeaders(final Connection<L> connection, final Object msg)

Inherited from org.glassfish.grizzly.http2.Http2BaseFilter:
applySettingscheckIfHttp2StreamChaincheckRequestHeadersOnUpgradecheckResponseHeadersOnUpgradecreateHttp2SessiongetConfigurationgetHttp2UpgradeSettingsgetLocalMaxFramePayloadSizeignoreFrameForStreamIdisHttp2UpgradingVersionobtainHttp2SessionobtainHttp2SessiononHttpContentEncodedonHttpContentErroronHttpContentParsedonHttpHeaderErroronHttpHeaderParsedonHttpHeadersEncodedonHttpHeadersParsedonHttpPacketParsedonInitialLineEncodedonInitialLineParsedonPrefaceReceivedprepareIncomingRequestprepareOutgoingRequestprocessFramessendRstStreamsendUpstreamsetLocalMaxFramePayloadSize

Field Detail

connectionUpgradeHeaderValueback to summary
private final HeaderValue connectionUpgradeHeaderValue
defaultClientAlpnNegotiatorback to summary
private final AlpnClientNegotiatorImpl defaultClientAlpnNegotiator
defaultHttp2Upgradeback to summary
private final HeaderValue defaultHttp2Upgrade
isNeverForceUpgradeback to summary
private boolean isNeverForceUpgrade
LOGGERback to summary
private static final Logger LOGGER

Hides org.glassfish.grizzly.http2.Http2BaseFilter.LOGGER.

sendPushRequestUpstreamback to summary
private boolean sendPushRequestUpstream

Constructor Detail

Http2ClientFilterback to summary
public Http2ClientFilter(final Http2Configuration configuration)

Method Detail

checkIfLastHttp11Chunkback to summary
private void checkIfLastHttp11Chunk(final FilterChainContext ctx, final Http2State http2State, final Object msg)
copyInterimResponseback to summary
private static HttpResponsePacket copyInterimResponse(final HttpRequestPacket request, final HttpResponsePacket source)

Creates a standalone copy of an interim (1xx) response so it can be delivered upstream while the shared response packet is reused for the final response. The copy is linked to the request (so it can resolve its processing state) without replacing the request's response binding.

createClientHttp2Sessionback to summary
protected Http2Session createClientHttp2Session(final Connection<L> connection)

Creates client-side Http2Session with pre-configured initial-windows-size and max-concurrent-streams.

Note

Should be called with disabled OP_READ (or during OP_READ processing), because peer frames must not be processed at the time this method is running.

Parameters
connection:Connection<L>

the TCP connection

Returns:Http2Session

Http2Session

getClientAlpnNegotiatorback to summary
protected AlpnClientNegotiator getClientAlpnNegotiator()
handleConnectback to summary
public NextAction handleConnect(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleConnect.

Implements org.glassfish.grizzly.filterchain.Filter.handleConnect.

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

Execute a unit of processing work to be performed, when channel gets connected. 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
@Override
handleEventback to summary
public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException

Overrides org.glassfish.grizzly.http2.Http2BaseFilter.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
@Override
handleWriteback to summary
public NextAction handleWrite(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.http2.Http2BaseFilter.handleWrite.

Implements org.glassfish.grizzly.filterchain.Filter.handleWrite.

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

Execute a unit of processing work to be performed, when some data should be written on channel. 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
@Override
isInterimResponseback to summary
private static boolean isInterimResponse(final HttpResponsePacket response)
isNeverForceUpgradeback to summary
public boolean isNeverForceUpgrade()
Returns:boolean

true if an upgrade to HTTP/2 will not be performed, otherwise false

isSendPushRequestUpstreamback to summary
public boolean isSendPushRequestUpstream()
Returns:boolean

true if the push request has to be sent upstream, so a user has an opportunity to process it, or false otherwise

prepareSettingsback to summary
protected SettingsFrame.SettingsFrameBuilder prepareSettings(final Http2Session http2Session)
processCompleteHeaderback to summary
protected void processCompleteHeader(final Http2Session http2Session, final FilterChainContext context, final HeaderBlockHead firstHeaderFrame) throws IOException

Implements abstract org.glassfish.grizzly.http2.Http2BaseFilter.processCompleteHeader.

Doc from org.glassfish.grizzly.http2.Http2BaseFilter.processCompleteHeader.

The method is called once complete HTTP header block arrives on Http2Session.

Annotations
@Override
Exceptions
IOException:
if an error occurs when dealing with the event.
processInPushPromiseback to summary
private void processInPushPromise(final Http2Session http2Session, final FilterChainContext context, final PushPromiseFrame pushPromiseFrame) throws Http2StreamException, IOException
Annotations
@SuppressWarnings:DuplicateThrows
processInResponseback to summary
private void processInResponse(final Http2Session http2Session, final FilterChainContext context, final HeadersFrame headersFrame) throws Http2SessionException, IOException
Annotations
@SuppressWarnings:DuplicateThrows
processOutgoingHttpHeaderback to summary
protected void processOutgoingHttpHeader(final FilterChainContext ctx, final Http2Session http2Session, final HttpHeader httpHeader, final HttpPacket entireHttpPacket) throws IOException

Implements abstract org.glassfish.grizzly.http2.Http2BaseFilter.processOutgoingHttpHeader.

Process the provided outbound header/packet.

Parameters
ctx:FilterChainContext

the current FilterChainContext

http2Session:Http2Session

the Http2Session that's being written to.

httpHeader:HttpHeader

the HttpHeader to write.

entireHttpPacket:HttpPacket

the HttpPacket to write.

Annotations
@SuppressWarnings:unchecked
@Override
Exceptions
IOException:
if an I/O error occurs.
processOutgoingRequestForNewStreamback to summary
private void processOutgoingRequestForNewStream(final FilterChainContext ctx, final Http2Session http2Session, final HttpRequestPacket request, final HttpPacket entireHttpPacket) throws IOException
Annotations
@SuppressWarnings:unchecked
setNeverForceUpgradeback to summary
public void setNeverForceUpgrade(boolean neverForceUpgrade)

Configure this filter to completely disable attempts to upgrade to HTTP/2.

Parameters
neverForceUpgrade:boolean

true to disable upgrade attempts, otherwise false

setSendPushRequestUpstreamback to summary
public void setSendPushRequestUpstream(boolean sendPushRequestUpstream)
Parameters
sendPushRequestUpstream:boolean

true if the push request has to be sent upstream, so a user has an opportunity to process it, or false otherwise

tryHttpUpgradeback to summary
private boolean tryHttpUpgrade(final FilterChainContext ctx, final Http2State http2State, final HttpRequestPacket httpRequest, final HttpResponsePacket httpResponse) throws Http2StreamException, IOException

The method is called once a client receives an HTTP response to its initial propose to establish HTTP/2.0 connection.

Parameters
ctx:FilterChainContext

the current FilterChainContext

http2State:Http2State

the HTTP2 connection state

httpRequest:HttpRequestPacket

the HTTP request

httpResponse:HttpResponsePacket

the HTTP response

Returns:boolean

true if the connection was successfully upgraded, otherwise false

Annotations
@SuppressWarnings:DuplicateThrows
Exceptions
Http2StreamException:
if an exception occurs with the stream
IOException:
if a general I/O error occurs
tryInsertHttpUpgradeHeadersback to summary
private boolean tryInsertHttpUpgradeHeaders(final Connection<L> connection, final Object msg)