Package com.linkedin.alpini.base.misc
Enum Class HeaderUtils
- All Implemented Interfaces:
Serializable,Comparable<HeaderUtils>,Constable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderappendHex(StringBuilder sb, int c) static StringbuildContentType(String type, String subType, Collection<Map.Entry<String, String>> parameters) static Stringstatic CharSequencecleanHeaderValue(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.static CharSequencecleanStatusMessage(CharSequence value) Cleans the status message and if no cleanup is required, returns the same String object.static StringBuilderescapeDelimiters(StringBuilder buffer, CharSequence text) static StringformatDate(Date date) static booleanisProhibitedCharacter(int c) Check if the character is prohibited in a HTTP header value.static booleanisQuotableParam(String value) From RFC1341, a quoted value may contain any character except control characters or '"'.static UUIDnameUUIDFromBytes(byte[] name) Static factory to retrieve a type 4 (pseudo-random)UUIDbased on the specified byte array after transformation with the Jenkins hash function.static HeaderUtils.ContentTypeparseContentType(String contentType) static UUIDStatic factory to retrieve a type 4 (pseudo randomly generated) UUID.static CharSequencesanitizeHeaderValue(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.static CharSequenceBuilds a new String, filtering out non-ASCII characters which are likely to cause problems.static HeaderUtilsReturns the enum constant of this class with the specified name.static HeaderUtils[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SINGLETON
-
-
Field Details
-
HTTP_DATE_FORMAT
- See Also:
-
HTTP_DATE_GMT_TIMEZONE
- See Also:
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
isQuotableParam
From RFC1341, a quoted value may contain any character except control characters or '"'. -
buildContentType
-
buildContentType
-
parseContentType
-
formatDate
-
sanitizeStatusMessage
Builds a new String, filtering out non-ASCII characters which are likely to cause problems.- Parameters:
value- Status message.- Returns:
- filtered message.
-
cleanStatusMessage
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
-
sanitizeHeaderValue
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
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
-
randomWeakUUID
Static factory to retrieve a type 4 (pseudo randomly generated) UUID. TheUUIDis generated using a cryptographically weak pseudo random number generator - theThreadLocalRandomgenerator.- Returns:
- A randomly generated
UUID
-
nameUUIDFromBytes
Static factory to retrieve a type 4 (pseudo-random)UUIDbased on the specified byte array after transformation with the Jenkins hash function.- Parameters:
name- A byte array to be used to construct aUUID- Returns:
- A
UUIDgenerated from the specified array
-