Package io.netty.handler.codec.http2
Class Http2Exception
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- io.netty.handler.codec.http2.Http2Exception
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
Http2Exception.ClosedStreamCreationException,Http2Exception.CompositeStreamException,Http2Exception.StreamException,Http2NoMoreStreamIdsException,StreamBufferingEncoder.Http2ChannelClosedException,StreamBufferingEncoder.Http2GoAwayException
public class Http2Exception extends java.lang.ExceptionException thrown when an HTTP/2 error was encountered.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttp2Exception.ClosedStreamCreationExceptionUsed when a stream creation attempt fails but may be because the stream was previously closed.static classHttp2Exception.CompositeStreamExceptionProvides the ability to handle multiple stream exceptions with one throw statement.static classHttp2Exception.HeaderListSizeExceptionstatic classHttp2Exception.ShutdownHintProvides a hint as to if shutdown is justified, what type of shutdown should be executed.static classHttp2Exception.StreamExceptionRepresents an exception that can be isolated to a single stream (as opposed to the entire connection).
-
Constructor Summary
Constructors Constructor Description Http2Exception(Http2Error error)Http2Exception(Http2Error error, Http2Exception.ShutdownHint shutdownHint)Http2Exception(Http2Error error, java.lang.String message)Http2Exception(Http2Error error, java.lang.String message, Http2Exception.ShutdownHint shutdownHint)Http2Exception(Http2Error error, java.lang.String message, java.lang.Throwable cause)Http2Exception(Http2Error error, java.lang.String message, java.lang.Throwable cause, Http2Exception.ShutdownHint shutdownHint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Http2ExceptionclosedStreamError(Http2Error error, java.lang.String fmt, java.lang.Object... args)Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.static Http2ExceptionconnectionError(Http2Error error, java.lang.String fmt, java.lang.Object... args)Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.static Http2ExceptionconnectionError(Http2Error error, java.lang.Throwable cause, java.lang.String fmt, java.lang.Object... args)Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.Http2Errorerror()static Http2ExceptionheaderListSizeError(int id, Http2Error error, boolean onDecode, java.lang.String fmt, java.lang.Object... args)A specific stream error resulting from failing to decode headers that exceeds the max header size list.static booleanisStreamError(Http2Exception e)Check if an exception is isolated to a single stream or the entire connection.Http2Exception.ShutdownHintshutdownHint()Provide a hint as to what type of shutdown should be executed.static Http2ExceptionstreamError(int id, Http2Error error, java.lang.String fmt, java.lang.Object... args)Use if an error which can be isolated to a single stream has occurred.static Http2ExceptionstreamError(int id, Http2Error error, java.lang.Throwable cause, java.lang.String fmt, java.lang.Object... args)Use if an error which can be isolated to a single stream has occurred.static intstreamId(Http2Exception e)Get the stream id associated with an exception.
-
-
-
Constructor Detail
-
Http2Exception
public Http2Exception(Http2Error error)
-
Http2Exception
public Http2Exception(Http2Error error, Http2Exception.ShutdownHint shutdownHint)
-
Http2Exception
public Http2Exception(Http2Error error, java.lang.String message)
-
Http2Exception
public Http2Exception(Http2Error error, java.lang.String message, Http2Exception.ShutdownHint shutdownHint)
-
Http2Exception
public Http2Exception(Http2Error error, java.lang.String message, java.lang.Throwable cause)
-
Http2Exception
public Http2Exception(Http2Error error, java.lang.String message, java.lang.Throwable cause, Http2Exception.ShutdownHint shutdownHint)
-
-
Method Detail
-
error
public Http2Error error()
-
shutdownHint
public Http2Exception.ShutdownHint shutdownHint()
Provide a hint as to what type of shutdown should be executed. Note this hint may be ignored.
-
connectionError
public static Http2Exception connectionError(Http2Error error, java.lang.String fmt, java.lang.Object... args)
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error- The type of error as defined by the HTTP/2 specification.fmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
connectionError
public static Http2Exception connectionError(Http2Error error, java.lang.Throwable cause, java.lang.String fmt, java.lang.Object... args)
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error- The type of error as defined by the HTTP/2 specification.cause- The object which caused the error.fmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
closedStreamError
public static Http2Exception closedStreamError(Http2Error error, java.lang.String fmt, java.lang.Object... args)
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error- The type of error as defined by the HTTP/2 specification.fmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
streamError
public static Http2Exception streamError(int id, Http2Error error, java.lang.String fmt, java.lang.Object... args)
Use if an error which can be isolated to a single stream has occurred. If theidis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.StreamExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.- Parameters:
id- The stream id for which the error is isolated to.error- The type of error as defined by the HTTP/2 specification.fmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- If the
idis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.StreamExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.
-
streamError
public static Http2Exception streamError(int id, Http2Error error, java.lang.Throwable cause, java.lang.String fmt, java.lang.Object... args)
Use if an error which can be isolated to a single stream has occurred. If theidis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.StreamExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.- Parameters:
id- The stream id for which the error is isolated to.error- The type of error as defined by the HTTP/2 specification.cause- The object which caused the error.fmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- If the
idis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.StreamExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.
-
headerListSizeError
public static Http2Exception headerListSizeError(int id, Http2Error error, boolean onDecode, java.lang.String fmt, java.lang.Object... args)
A specific stream error resulting from failing to decode headers that exceeds the max header size list. If theidis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.StreamExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.- Parameters:
id- The stream id for which the error is isolated to.error- The type of error as defined by the HTTP/2 specification.onDecode- Whether this error was caught while decoding headersfmt- String with the content and format for the additional debug data.args- Objects which fit into the format defined byfmt.- Returns:
- If the
idis notHttp2CodecUtil.CONNECTION_STREAM_IDthen aHttp2Exception.HeaderListSizeExceptionwill be returned. Otherwise the error is considered a connection error and aHttp2Exceptionis returned.
-
isStreamError
public static boolean isStreamError(Http2Exception e)
Check if an exception is isolated to a single stream or the entire connection.- Parameters:
e- The exception to check.- Returns:
trueifeis an instance ofHttp2Exception.StreamException.falseotherwise.
-
streamId
public static int streamId(Http2Exception e)
Get the stream id associated with an exception.- Parameters:
e- The exception to get the stream id for.- Returns:
Http2CodecUtil.CONNECTION_STREAM_IDifeis a connection error. Otherwise the stream id associated with the stream error.
-
-