Example usage for io.netty.handler.codec.http2 Http2Exception error

List of usage examples for io.netty.handler.codec.http2 Http2Exception error

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2Exception error.

Prototype

Http2Error error

To view the source code for io.netty.handler.codec.http2 Http2Exception error.

Click Source Link

Usage

From source file:com.linecorp.armeria.common.http.AbstractHttpToHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, Throwable cause, Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;//from ww w  . j  a  v  a  2s.  co  m
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, cause, http2Ex);
}

From source file:com.linecorp.armeria.internal.AbstractHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
        Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;/*from w w  w  .j a v a2  s . co m*/
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, outbound, cause, http2Ex);
}

From source file:org.apache.dubbo.remoting.etcd.option.OptionUtil.java

License:Apache License

public static boolean isProtocolError(Throwable e) {
    if (e == null) {
        return false;
    }//w  w  w .ja  v a2 s  .co m
    Throwable cause = e.getCause();
    while (cause != null) {
        if (cause instanceof Http2Exception) {
            Http2Exception t = (Http2Exception) cause;
            if ("PROTOCOL_ERROR".equals(t.error().name())) {
                return true;
            }
        }
        cause = cause.getCause();
    }
    return false;
}