Class HTTP2Util

java.lang.Object
org.omegazero.http.h2.util.HTTP2Util

public final class HTTP2Util extends Object
HTTP/2 utility functions.
Since:
1.2.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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 Type
    Method
    Description
    static 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 data
      offset - 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