Package org.eclipse.jetty.http
Class UriCompliance
java.lang.Object
org.eclipse.jetty.http.UriCompliance
- All Implemented Interfaces:
ComplianceViolation.Mode
URI compliance modes for Jetty request handling.
A Compliance mode consists of a set of
UriCompliance.Violation
s which are allowed
when the mode is enabled.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
These are URI compliance "violations", which may be allowed by the compliance mode. -
Field Summary
Modifier and TypeFieldDescriptionstatic final UriCompliance
The default compliance mode that extends RFC3986 compliance with additional violations to avoid most ambiguous URIs.static final UriCompliance
LEGACY compliance mode that models Jetty-9.4 behavior by allowingUriCompliance.Violation.AMBIGUOUS_PATH_SEGMENT
,UriCompliance.Violation.AMBIGUOUS_EMPTY_SEGMENT
,UriCompliance.Violation.AMBIGUOUS_PATH_SEPARATOR
,UriCompliance.Violation.AMBIGUOUS_PATH_ENCODING
andUriCompliance.Violation.UTF16_ENCODINGS
protected static final org.slf4j.Logger
static final UriCompliance
Compliance mode that exactly follows RFC3986, including allowing all additional ambiguous URI Violations.static final UriCompliance
Compliance mode that follows RFC3986 plus it does not allow any ambiguous URIUriCompliance.Violation
s.static final UriCompliance
Deprecated.equivalent to DEFAULTstatic final UriCompliance
Deprecated.equivalent to RFC3986static final UriCompliance
Compliance mode that allows all URI Violations, including allowing ambiguous paths in non canonicalized form. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
allows
(ComplianceViolation violation) static String
checkUriCompliance
(UriCompliance compliance, HttpURI uri) static UriCompliance
Create compliance set from string.static UriCompliance
from
(Set<UriCompliance.Violation> violations) Create compliance set from a set of allowed Violations.Get the set ofUriCompliance.Violation
s allowed by this compliance mode.getKnown()
getName()
toString()
static UriCompliance
with
(String name, UriCompliance.Violation... violations) Create a new UriCompliance mode that includes the passedUriCompliance.Violation
s.without
(String name, UriCompliance.Violation... violations) Create a new UriCompliance mode that excludes the passedUriCompliance.Violation
s.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
DEFAULT
The default compliance mode that extends RFC3986 compliance with additional violations to avoid most ambiguous URIs. This mode does allowUriCompliance.Violation.AMBIGUOUS_PATH_SEPARATOR
,UriCompliance.Violation.AMBIGUOUS_PATH_ENCODING
, but disallows all outUriCompliance.Violation
s. -
LEGACY
LEGACY compliance mode that models Jetty-9.4 behavior by allowingUriCompliance.Violation.AMBIGUOUS_PATH_SEGMENT
,UriCompliance.Violation.AMBIGUOUS_EMPTY_SEGMENT
,UriCompliance.Violation.AMBIGUOUS_PATH_SEPARATOR
,UriCompliance.Violation.AMBIGUOUS_PATH_ENCODING
andUriCompliance.Violation.UTF16_ENCODINGS
-
RFC3986
Compliance mode that exactly follows RFC3986, including allowing all additional ambiguous URI Violations. -
RFC3986_UNAMBIGUOUS
Compliance mode that follows RFC3986 plus it does not allow any ambiguous URIUriCompliance.Violation
s. -
UNSAFE
Compliance mode that allows all URI Violations, including allowing ambiguous paths in non canonicalized form. -
SAFE
Deprecated.equivalent to DEFAULT -
STRICT
Deprecated.equivalent to RFC3986
-
-
Constructor Details
-
UriCompliance
-
-
Method Details
-
valueOf
-
from
Create compliance set from a set of allowed Violations.- Parameters:
violations
- A string of violations to allow:- Returns:
- the compliance from the string spec
-
from
Create compliance set from string.Format: <BASE>[,[-]<violation>]...
BASE is one of:
- 0
- No
UriCompliance.Violation
s - *
- All
UriCompliance.Violation
s - <name>
- The name of a static instance of UriCompliance (e.g.
RFC3986
).
The remainder of the list can contain then names of
UriCompliance.Violation
s to include them in the mode, or prefixed with a '-' to exclude them from the mode. Examples are:0,AMBIGUOUS_PATH_PARAMETER
- Only allow
UriCompliance.Violation.AMBIGUOUS_PATH_PARAMETER
*,-AMBIGUOUS_PATH_PARAMETER
- Only all except
UriCompliance.Violation.AMBIGUOUS_PATH_PARAMETER
RFC3986,AMBIGUOUS_PATH_PARAMETER
- Same as RFC3986 plus
UriCompliance.Violation.AMBIGUOUS_PATH_PARAMETER
- Parameters:
spec
- A string describing the compliance- Returns:
- the UriCompliance instance derived from the string description
-
allows
- Specified by:
allows
in interfaceComplianceViolation.Mode
- Parameters:
violation
- TheComplianceViolation
to test- Returns:
- true iff the violation is allowed by this mode.
-
getName
- Specified by:
getName
in interfaceComplianceViolation.Mode
- Returns:
- The name of the compliance violation mode.
-
getAllowed
Get the set ofUriCompliance.Violation
s allowed by this compliance mode.- Specified by:
getAllowed
in interfaceComplianceViolation.Mode
- Returns:
- The immutable set of
UriCompliance.Violation
s allowed by this compliance mode.
-
getKnown
- Specified by:
getKnown
in interfaceComplianceViolation.Mode
- Returns:
- The immutable set of all known violations for this mode.
-
with
Create a new UriCompliance mode that includes the passedUriCompliance.Violation
s.- Parameters:
name
- The name of the new modeviolations
- The violations to include- Returns:
- A new
UriCompliance
mode.
-
without
Create a new UriCompliance mode that excludes the passedUriCompliance.Violation
s.- Parameters:
name
- The name of the new modeviolations
- The violations to exclude- Returns:
- A new
UriCompliance
mode.
-
toString
-
checkUriCompliance
-