Package org.glassfish.grizzly.http2
Class Http2ClientFilter
java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.http.HttpBaseFilter
org.glassfish.grizzly.http2.Http2BaseFilter
org.glassfish.grizzly.http2.Http2ClientFilter
- All Implemented Interfaces:
Filter
- Author:
- oleksiys
-
Field Summary
Fields inherited from class org.glassfish.grizzly.http2.Http2BaseFilter
FIXED_LENGTH_ENCODING, threadPool -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Http2SessioncreateClientHttp2Session(Connection connection) Creates client-sideHttp2Sessionwith pre-configured initial-windows-size and max-concurrent-streams.protected AlpnClientNegotiatorExecute a unit of processing work to be performed, when channel gets connected.handleEvent(FilterChainContext ctx, FilterChainEvent event) Handle custom event associated with theConnection.Execute a unit of processing work to be performed, when channel will become available for reading.Execute a unit of processing work to be performed, when some data should be written on channel.booleanbooleanprotected SettingsFrame.SettingsFrameBuilderprepareSettings(Http2Session http2Session) protected voidprocessCompleteHeader(Http2Session http2Session, FilterChainContext context, HeaderBlockHead firstHeaderFrame) The method is called once complete HTTP header block arrives onHttp2Session.protected voidprocessOutgoingHttpHeader(FilterChainContext ctx, Http2Session http2Session, HttpHeader httpHeader, HttpPacket entireHttpPacket) Process the provided outbound header/packet.voidsetNeverForceUpgrade(boolean neverForceUpgrade) Configure this filter to completely disable attempts to upgrade to HTTP/2.voidsetSendPushRequestUpstream(boolean sendPushRequestUpstream) Methods inherited from class org.glassfish.grizzly.http2.Http2BaseFilter
checkRequestHeadersOnUpgrade, checkResponseHeadersOnUpgrade, createHttp2Session, getConfiguration, getHttp2UpgradeSettings, getLocalMaxFramePayloadSize, ignoreFrameForStreamId, isHttp2UpgradingVersion, obtainHttp2Session, onHttpContentEncoded, onHttpContentError, onHttpContentParsed, onHttpHeaderError, onHttpHeaderParsed, onHttpHeadersEncoded, onHttpHeadersParsed, onHttpPacketParsed, onInitialLineEncoded, onInitialLineParsed, onPrefaceReceived, prepareOutgoingRequest, processFrames, setLocalMaxFramePayloadSizeMethods inherited from class org.glassfish.grizzly.http.HttpBaseFilter
bindMethods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, handleAccept, handleClose, onAdded, onFilterChainChanged, onRemoved, toString
-
Constructor Details
-
Http2ClientFilter
-
-
Method Details
-
isNeverForceUpgrade
public boolean isNeverForceUpgrade()- Returns:
trueif an upgrade to HTTP/2 will not be performed, otherwisefalse
-
setNeverForceUpgrade
public void setNeverForceUpgrade(boolean neverForceUpgrade) Configure this filter to completely disable attempts to upgrade to HTTP/2.- Parameters:
neverForceUpgrade-trueto disable upgrade attempts, otherwisefalse
-
isSendPushRequestUpstream
public boolean isSendPushRequestUpstream()- Returns:
- true if the push request has to be sent upstream, so a user have a chance to process it, or false otherwise
-
setSendPushRequestUpstream
public void setSendPushRequestUpstream(boolean sendPushRequestUpstream) - Parameters:
sendPushRequestUpstream- true if the push request has to be sent upstream, so a user have a chance to process it, or false otherwise
-
handleConnect
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when channel gets connected. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleConnectin interfaceFilter- Overrides:
handleConnectin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleRead
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when channel will become available for reading. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleReadin interfaceFilter- Overrides:
handleReadin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleWrite
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when some data should be written on channel. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleWritein interfaceFilter- Overrides:
handleWritein classHttp2BaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleEvent
Description copied from class:BaseFilterHandle custom event associated with theConnection. ThisFiltermay either complete the required processing and returnStopAction, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returningInvokeAction.- Specified by:
handleEventin interfaceFilter- Overrides:
handleEventin classHttp2BaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
processOutgoingHttpHeader
protected void processOutgoingHttpHeader(FilterChainContext ctx, Http2Session http2Session, HttpHeader httpHeader, HttpPacket entireHttpPacket) throws IOException Process the provided outbound header/packet.- Specified by:
processOutgoingHttpHeaderin classHttp2BaseFilter- Parameters:
ctx- the currentFilterChainContexthttp2Session- theHttp2Sessionthat's being written to.httpHeader- theHttpHeaderto write.entireHttpPacket- theHttpPacketto write.- Throws:
IOException- if an I/O error occurs.
-
createClientHttp2Session
Creates client-sideHttp2Sessionwith 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- the TCP connection- Returns:
Http2Session
-
getClientAlpnNegotiator
-
processCompleteHeader
protected void processCompleteHeader(Http2Session http2Session, FilterChainContext context, HeaderBlockHead firstHeaderFrame) throws IOException Description copied from class:Http2BaseFilterThe method is called once complete HTTP header block arrives onHttp2Session.- Specified by:
processCompleteHeaderin classHttp2BaseFilter- Parameters:
http2Session- theHttp2Sessionassociated with this header.context- the currentFilterChainContextfirstHeaderFrame- the firstHeaderBlockHeadfrom the firstHeadersFramereceived.- Throws:
IOException- if an error occurs when dealing with the event.
-
prepareSettings
-