public class Http2StateUtil extends Object
| Constructor and Description |
|---|
Http2StateUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
beginResponseWrite(Http2MessageStateContext http2MessageStateContext,
Http2OutboundRespListener http2OutboundRespListener,
HttpCarbonMessage outboundResponseMsg,
io.netty.handler.codec.http.HttpContent httpContent,
int streamId) |
static void |
initHttp2MessageContext(HttpCarbonMessage outboundRequest,
Http2TargetHandler http2TargetHandler) |
static int |
initiateStream(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Connection connection,
Http2ClientChannel http2ClientChannel,
OutboundMsgHolder outboundMsgHolder)
Initiates a HTTP2 stream.
|
static boolean |
isValidStreamId(int streamId,
io.netty.handler.codec.http2.Http2Connection conn)
Checks for the validity of stream id.
|
static void |
notifyRequestListener(Http2SourceHandler http2SourceHandler,
InboundMessageHolder inboundMessageHolder,
int streamId)
Notifies the registered listeners which listen for the incoming carbon messages.
|
static void |
onPushPromiseRead(io.netty.channel.ChannelHandlerContext ctx,
Http2PushPromise http2PushPromise,
Http2ClientChannel http2ClientChannel,
OutboundMsgHolder outboundMsgHolder)
Adds a push promise message.
|
static void |
releaseContent(io.netty.handler.codec.http.HttpContent httpContent)
Releases the
ByteBuf content. |
static void |
releaseDataFrame(Http2SourceHandler http2SourceHandler,
Http2DataFrame dataFrame)
Releases the
ByteBuf content. |
static void |
sendRequestTimeoutResponse(io.netty.channel.ChannelHandlerContext ctx,
Http2OutboundRespListener http2OutboundRespListener,
int streamId,
io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus,
io.netty.buffer.ByteBuf content,
boolean handleIncompleteRequest,
boolean whileReceivingHeader) |
static void |
sendRstFrame(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
int streamId)
Sends
Http2Reset frame with `NO_ERROR` error code. |
static HttpCarbonRequest |
setupCarbonRequest(io.netty.handler.codec.http.HttpRequest httpRequest,
Http2SourceHandler http2SourceHandler,
int streamId)
Creates a
HttpCarbonRequest from HttpRequest. |
static void |
validatePromisedStreamState(int originalStreamId,
int streamId,
io.netty.handler.codec.http2.Http2Connection conn,
HttpCarbonMessage inboundRequestMsg)
Validates the state of promised stream with the original stream id and given stream id.
|
static void |
writeHttp2Headers(io.netty.channel.ChannelHandlerContext ctx,
OutboundMsgHolder outboundMsgHolder,
Http2ClientChannel http2ClientChannel,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
int streamId,
io.netty.handler.codec.http.HttpHeaders headers,
io.netty.handler.codec.http2.Http2Headers http2Headers,
boolean endStream)
Writes HTTP2 headers.
|
static void |
writeHttp2Promise(Http2PushPromise pushPromise,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Connection conn,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
HttpCarbonMessage inboundRequestMsg,
HttpResponseFuture outboundRespStatusFuture,
int originalStreamId)
Writes an HTTP2 promise.
|
static void |
writeHttp2ResponseHeaders(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
HttpResponseFuture outboundRespStatusFuture,
int streamId,
io.netty.handler.codec.http2.Http2Headers http2Headers,
boolean endStream,
Http2OutboundRespListener respListener)
Writes HTTP2 headers to outbound response.
|
public static void notifyRequestListener(Http2SourceHandler http2SourceHandler, InboundMessageHolder inboundMessageHolder, int streamId)
http2SourceHandler - the HTTP2 source handlerinboundMessageHolder - the inbound http request holderstreamId - the id of the streampublic static HttpCarbonRequest setupCarbonRequest(io.netty.handler.codec.http.HttpRequest httpRequest, Http2SourceHandler http2SourceHandler, int streamId)
HttpCarbonRequest from HttpRequest.httpRequest - the HTTPRequest messagehttp2SourceHandler - the HTTP/2 source handlerstreamId - the stream idpublic static void writeHttp2ResponseHeaders(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
HttpResponseFuture outboundRespStatusFuture,
int streamId,
io.netty.handler.codec.http2.Http2Headers http2Headers,
boolean endStream,
Http2OutboundRespListener respListener)
throws io.netty.handler.codec.http2.Http2Exception
ctx - the channel handler contextencoder - the HTTP2 connection encoderoutboundRespStatusFuture - the future of outbound response write operationstreamId - the id of the streamhttp2Headers - the Http2Headers received over a HTTP/2 streamendStream - is this the end of streamrespListener - http/2 outbound response listenerio.netty.handler.codec.http2.Http2Exception - throws if a protocol-related error occurredpublic static void writeHttp2Promise(Http2PushPromise pushPromise, io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2Connection conn, io.netty.handler.codec.http2.Http2ConnectionEncoder encoder, HttpCarbonMessage inboundRequestMsg, HttpResponseFuture outboundRespStatusFuture, int originalStreamId) throws io.netty.handler.codec.http2.Http2Exception
pushPromise - HTTP/2 promise messagectx - the channel handler contextconn - HTTP2 connectionencoder - the HTTP2 connection encoderinboundRequestMsg - request message received from the clientoutboundRespStatusFuture - the future of outbound response write operationoriginalStreamId - the original id of the streamio.netty.handler.codec.http2.Http2Exception - throws if a protocol-related error occurredpublic static void validatePromisedStreamState(int originalStreamId,
int streamId,
io.netty.handler.codec.http2.Http2Connection conn,
HttpCarbonMessage inboundRequestMsg)
throws io.netty.handler.codec.http2.Http2Exception
originalStreamId - the original id of the streamstreamId - the id of the stream to be validatedconn - HTTP2 connectioninboundRequestMsg - request message received from the clientio.netty.handler.codec.http2.Http2Exception - throws if stream id is not valid for given connectionpublic static boolean isValidStreamId(int streamId,
io.netty.handler.codec.http2.Http2Connection conn)
streamId - the id of the streamconn - HTTP2 connectionpublic static void releaseDataFrame(Http2SourceHandler http2SourceHandler, Http2DataFrame dataFrame)
ByteBuf content.http2SourceHandler - the HTTP2 source handlerdataFrame - the HTTP2 data frame to be releasedpublic static void sendRstFrame(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
int streamId)
throws io.netty.handler.codec.http2.Http2Exception
Http2Reset frame with `NO_ERROR` error code.ctx - the channel handler contextencoder - the HTTP2 connection encoderstreamId - id of the stream need to be send RST_FRAMEio.netty.handler.codec.http2.Http2Exception - if a protocol-related error occurredpublic static void writeHttp2Headers(io.netty.channel.ChannelHandlerContext ctx,
OutboundMsgHolder outboundMsgHolder,
Http2ClientChannel http2ClientChannel,
io.netty.handler.codec.http2.Http2ConnectionEncoder encoder,
int streamId,
io.netty.handler.codec.http.HttpHeaders headers,
io.netty.handler.codec.http2.Http2Headers http2Headers,
boolean endStream)
throws io.netty.handler.codec.http2.Http2Exception
ctx - the channel handler contextoutboundMsgHolder - the outbound message holderhttp2ClientChannel - the client channel related to the handlerencoder - the HTTP2 connection encoderstreamId - the id of the streamheaders - the HTTP headershttp2Headers - the HTTP2 headersendStream - is this the end of streamio.netty.handler.codec.http2.Http2Exception - if a protocol-related error occurredpublic static int initiateStream(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Connection connection,
Http2ClientChannel http2ClientChannel,
OutboundMsgHolder outboundMsgHolder)
throws io.netty.handler.codec.http2.Http2Exception
ctx - the channel handler contextconnection - the HTTP2 connectionhttp2ClientChannel - the client channel related to the handleroutboundMsgHolder - the outbound message holderio.netty.handler.codec.http2.Http2Exception - if a protocol-related error occurredpublic static void onPushPromiseRead(io.netty.channel.ChannelHandlerContext ctx,
Http2PushPromise http2PushPromise,
Http2ClientChannel http2ClientChannel,
OutboundMsgHolder outboundMsgHolder)
ctx - the channel handler contexthttp2PushPromise - the HTTP2 push promisehttp2ClientChannel - the client channel related to the handleroutboundMsgHolder - the outbound message holderpublic static void releaseContent(io.netty.handler.codec.http.HttpContent httpContent)
ByteBuf content.httpContent - the HTTP2 contentpublic static void sendRequestTimeoutResponse(io.netty.channel.ChannelHandlerContext ctx,
Http2OutboundRespListener http2OutboundRespListener,
int streamId,
io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus,
io.netty.buffer.ByteBuf content,
boolean handleIncompleteRequest,
boolean whileReceivingHeader)
public static void initHttp2MessageContext(HttpCarbonMessage outboundRequest, Http2TargetHandler http2TargetHandler)
public static void beginResponseWrite(Http2MessageStateContext http2MessageStateContext, Http2OutboundRespListener http2OutboundRespListener, HttpCarbonMessage outboundResponseMsg, io.netty.handler.codec.http.HttpContent httpContent, int streamId) throws io.netty.handler.codec.http2.Http2Exception
io.netty.handler.codec.http2.Http2ExceptionCopyright © 2021 WSO2. All rights reserved.