Package org.omegazero.http.h2.util
Class HTTP2Util
java.lang.Object
org.omegazero.http.h2.util.HTTP2Util
HTTP/2 utility functions.
- Since:
- 1.2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Whether the full stack trace of a HTTP/2 error should be printed instead of just the error message. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
Returns a copy of the byte array containing the HTTP/2 client connection preface.static int
Returns the length of the HTTP/2 client connection preface.static boolean
isValidClientPreface
(byte[] data) Checks whether the given data is a valid HTTP/2 client connection preface.static boolean
isValidClientPreface
(byte[] data, int offset) Checks whether the given data, starting at offset, is a valid HTTP/2 client connection preface.
-
Field Details
-
PRINT_STACK_TRACES
public static final boolean PRINT_STACK_TRACESWhether the full stack trace of a HTTP/2 error should be printed instead of just the error message.System property
org.omegazero.http.h2.printStackTraces
If this property is not defined and omz-net-lib is available, this value will be the value oforg.omegazero.net.common.NetCommon.PRINT_STACK_TRACES
. If neither is the case, this value defaults tofalse
.
-
-
Method Details
-
isValidClientPreface
public static boolean isValidClientPreface(byte[] data) Checks whether the given data is a valid HTTP/2 client connection preface.A call to this method is equivalent to a call to
isValidClientPreface
(data, 0)- Parameters:
data
- The data- Returns:
true
if the given data is a valid client connection preface
-
isValidClientPreface
public static boolean isValidClientPreface(byte[] data, int offset) Checks whether the given data, starting at offset, is a valid HTTP/2 client connection preface.- Parameters:
data
- The dataoffset
- The offset- Returns:
true
if the given data is a valid client connection preface- See Also:
-
- RFC 7540, section 3.5
-
getClientPreface
public static byte[] getClientPreface()Returns a copy of the byte array containing the HTTP/2 client connection preface.- Returns:
- The client connection preface
- See Also:
-
- RFC 7540, section 3.5
-
getClientPrefaceLength
public static int getClientPrefaceLength()Returns the length of the HTTP/2 client connection preface.- Returns:
- The client connection preface length in bytes
-