io.netty.handler.codec.http2.Http2ResetFrame Java Examples

The following examples show how to use io.netty.handler.codec.http2.Http2ResetFrame. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Http2MetricsChannelHandlers.java    From zuul with Apache License 2.0 6 votes vote down vote up
protected static void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame)
{
    long errorCode;
    if (frame instanceof Http2ResetFrame) {
        errorCode = ((Http2ResetFrame) frame).errorCode();
    }
    else if (frame instanceof Http2GoAwayFrame) {
        errorCode = ((Http2GoAwayFrame) frame).errorCode();
    }
    else {
        errorCode = -1;
    }

    registry.counter(counterName,
            "id", metricId,
            "frame", frame.name(),
            "error_code", Long.toString(errorCode))
            .increment();
}
 
Example #2
Source File: AbstractH2DuplexHandler.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
@Override
public final void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
    if (evt instanceof Http2ResetFrame) {
        Http2ResetFrame resetFrame = (Http2ResetFrame) evt;
        if (resetFrame.errorCode() == REFUSED_STREAM.code()) {
            ctx.fireExceptionCaught(new H2StreamRefusedException("RST_STREAM received. stream refused"));
        } else {
            ctx.fireExceptionCaught(new H2StreamResetException("RST_STREAM received with error code: " +
                    resetFrame.errorCode()));
        }
    } else {
        ctx.fireUserEventTriggered(evt);
    }
}
 
Example #3
Source File: Http2ToHttpInboundAdapter.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, Http2Frame frame) throws Exception {
    if (frame instanceof Http2DataFrame) {
        onDataRead((Http2DataFrame) frame, ctx);
    } else if (frame instanceof Http2HeadersFrame) {
        onHeadersRead((Http2HeadersFrame) frame, ctx);
        ctx.channel().read();
    } else if (frame instanceof Http2ResetFrame) {
        onRstStreamRead((Http2ResetFrame) frame, ctx);
    } else {
        // TODO this is related to the inbound window update bug. Revisit
        ctx.channel().parent().read();
    }
}
 
Example #4
Source File: Http2ResetFrameHandler.java    From zuul with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
{
    if (msg instanceof Http2ResetFrame) {
        // Inform zuul to cancel the request.
        ctx.fireUserEventTriggered(new RequestCancelledEvent());
    }
    else {
        super.channelRead(ctx, msg);
    }
}
 
Example #5
Source File: Http2ToHttpInboundAdapter.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
private void onRstStreamRead(Http2ResetFrame resetFrame, ChannelHandlerContext ctx) throws Http2Exception {
    ctx.fireExceptionCaught(new Http2ResetException(resetFrame.errorCode()));
}