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.Violations which are allowed
when the mode is enabled.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThese are URI compliance "violations", which may be allowed by the compliance mode. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UriComplianceThe default compliance mode that extends RFC3986 compliance with additional violations to avoid most ambiguous URIs.static final UriComplianceLEGACY 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_ENCODINGandUriCompliance.Violation.UTF16_ENCODINGSprotected static final org.slf4j.Loggerstatic final UriComplianceCompliance mode that exactly follows RFC3986, including allowing all additional ambiguous URI Violations.static final UriComplianceCompliance mode that follows RFC3986 plus it does not allow any ambiguous URIUriCompliance.Violations.static final UriComplianceDeprecated.equivalent to DEFAULTstatic final UriComplianceDeprecated.equivalent to RFC3986static final UriComplianceCompliance mode that allows all URI Violations, including allowing ambiguous paths in non canonicalized form. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallows(ComplianceViolation violation) static StringcheckUriCompliance(UriCompliance compliance, HttpURI uri) static UriComplianceCreate compliance set from string.static UriCompliancefrom(Set<UriCompliance.Violation> violations) Create compliance set from a set of allowed Violations.Get the set ofUriCompliance.Violations allowed by this compliance mode.getKnown()getName()toString()static UriCompliancewith(String name, UriCompliance.Violation... violations) Create a new UriCompliance mode that includes the passedUriCompliance.Violations.without(String name, UriCompliance.Violation... violations) Create a new UriCompliance mode that excludes the passedUriCompliance.Violations.
-
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.Violations. -
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_ENCODINGandUriCompliance.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.Violations. -
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.Violations - *
- All
UriCompliance.Violations - <name>
- The name of a static instance of UriCompliance (e.g.
RFC3986).
The remainder of the list can contain then names of
UriCompliance.Violations 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:
allowsin interfaceComplianceViolation.Mode- Parameters:
violation- TheComplianceViolationto test- Returns:
- true iff the violation is allowed by this mode.
-
getName
- Specified by:
getNamein interfaceComplianceViolation.Mode- Returns:
- The name of the compliance violation mode.
-
getAllowed
Get the set ofUriCompliance.Violations allowed by this compliance mode.- Specified by:
getAllowedin interfaceComplianceViolation.Mode- Returns:
- The immutable set of
UriCompliance.Violations allowed by this compliance mode.
-
getKnown
- Specified by:
getKnownin interfaceComplianceViolation.Mode- Returns:
- The immutable set of all known violations for this mode.
-
with
Create a new UriCompliance mode that includes the passedUriCompliance.Violations.- Parameters:
name- The name of the new modeviolations- The violations to include- Returns:
- A new
UriCompliancemode.
-
without
Create a new UriCompliance mode that excludes the passedUriCompliance.Violations.- Parameters:
name- The name of the new modeviolations- The violations to exclude- Returns:
- A new
UriCompliancemode.
-
toString
-
checkUriCompliance
-