Enum Class HeaderUtils

java.lang.Object
java.lang.Enum<HeaderUtils>
com.linkedin.alpini.base.misc.HeaderUtils
All Implemented Interfaces:
Serializable, Comparable<HeaderUtils>, Constable

public enum HeaderUtils extends Enum<HeaderUtils>
  • Enum Constant Details

    • SINGLETON

      public static final HeaderUtils SINGLETON
  • Field Details

  • Method Details

    • values

      public static HeaderUtils[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HeaderUtils valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isQuotableParam

      public static boolean isQuotableParam(String value)
      From RFC1341, a quoted value may contain any character except control characters or '"'.
    • buildContentType

      public static String buildContentType(String type, String subType, Collection<Map.Entry<String,String>> parameters)
    • buildContentType

      public static String buildContentType(String type, String subType, Iterator<Map.Entry<String,String>> parameters)
    • parseContentType

      public static HeaderUtils.ContentType parseContentType(String contentType)
    • formatDate

      public static String formatDate(Date date)
    • sanitizeStatusMessage

      @Nonnull public static CharSequence sanitizeStatusMessage(@Nonnull CharSequence value)
      Builds a new String, filtering out non-ASCII characters which are likely to cause problems.
      Parameters:
      value - Status message.
      Returns:
      filtered message.
    • cleanStatusMessage

      @Nonnull public static CharSequence cleanStatusMessage(CharSequence value)
      Cleans the status message and if no cleanup is required, returns the same String object.
      Parameters:
      value - Status message.
      Returns:
      filtered message.
    • isProhibitedCharacter

      public static boolean isProhibitedCharacter(int c)
      Check if the character is prohibited in a HTTP header value.
    • appendHex

      @Nonnull public static StringBuilder appendHex(@Nonnull StringBuilder sb, int c)
    • sanitizeHeaderValue

      @Nonnull public static CharSequence sanitizeHeaderValue(@Nonnull CharSequence value)
      Builds a new String, filtering out values and performing fixup to provide a value which may be set as a HTTP header value. The implementation of this method is based upon the value validation code in Netty 3.7.1
      Parameters:
      value - header value.
      Returns:
      filtered value.
    • cleanHeaderValue

      @Nonnull public static CharSequence cleanHeaderValue(CharSequence value)
      Checks to ensure that a provided header value may be used as-is or returns a new string which has been appropiately filtered. The implementation of this method is based upon the value validation code in Netty 3.7.1
      Parameters:
      value - header value.
      Returns:
      filtered value.
    • escapeDelimiters

      public static StringBuilder escapeDelimiters(StringBuilder buffer, CharSequence text)
    • randomWeakUUID

      public static UUID randomWeakUUID()
      Static factory to retrieve a type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically weak pseudo random number generator - the ThreadLocalRandom generator.
      Returns:
      A randomly generated UUID
    • nameUUIDFromBytes

      public static UUID nameUUIDFromBytes(byte[] name)
      Static factory to retrieve a type 4 (pseudo-random) UUID based on the specified byte array after transformation with the Jenkins hash function.
      Parameters:
      name - A byte array to be used to construct a UUID
      Returns:
      A UUID generated from the specified array