Top Description Constructors Methods
org.eclipse.jetty.http

public final Class Syntax

extends Object
Class Inheritance
Imports
java.util.Objects

Collection of Syntax validation methods.

Use in a similar way as you would java.util.Objects#requireNonNull(Object)

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
requireValidRFC2616Token(String
the value to test
value
,
String
the message to be prefixed if an IllegalArgumentException is thrown.
msg
)

Per RFC2616: Section 2.2, a token follows these syntax rules

 token          = 1*<any CHAR except CTLs or separators>
 CHAR           = <any US-ASCII character (octets 0 - 127)>
 CTL            = <any US-ASCII control character
                  (octets 0 - 31) and DEL (127)>
 separators     = "(" | ")" | "<" | ">" | "@"
                | "," | ";" | ":" | "\" | <">
                | "/" | "[" | "]" | "?" | "="
                | "{" | "}" | SP | HT
public static void
requireValidRFC6265CookieValue(String
the value to test
value
)

Per RFC6265, Cookie.value follows these syntax rules

 cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
 cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
                     ; US-ASCII characters excluding CTLs,
                     ; whitespace DQUOTE, comma, semicolon,
                     ; and backslash
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Syntaxback to summary
public Syntax()

Method Detail

requireValidRFC2616Tokenback to summary
public static void requireValidRFC2616Token(String value, String msg)

Per RFC2616: Section 2.2, a token follows these syntax rules

 token          = 1*<any CHAR except CTLs or separators>
 CHAR           = <any US-ASCII character (octets 0 - 127)>
 CTL            = <any US-ASCII control character
                  (octets 0 - 31) and DEL (127)>
 separators     = "(" | ")" | "<" | ">" | "@"
                | "," | ";" | ":" | "\" | <">
                | "/" | "[" | "]" | "?" | "="
                | "{" | "}" | SP | HT
Parameters
value:String

the value to test

msg:String

the message to be prefixed if an IllegalArgumentException is thrown.

Exceptions
IllegalArgumentException:
if the value is invalid per spec
requireValidRFC6265CookieValueback to summary
public static void requireValidRFC6265CookieValue(String value)

Per RFC6265, Cookie.value follows these syntax rules

 cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
 cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
                     ; US-ASCII characters excluding CTLs,
                     ; whitespace DQUOTE, comma, semicolon,
                     ; and backslash
Parameters
value:String

the value to test

Exceptions
IllegalArgumentException:
if the value is invalid per spec