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 EnumSet<UriCompliance.Violation>static final UriCompliancestatic 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_ENCODINGS.static final UriComplianceCompliance mode that exactly follows RFC3986, excluding all URI Violations.static final UriComplianceCompliance mode that allows all unambiguous violations.static final UriComplianceCompliance mode that allows all URI Violations, including allowing ambiguous paths in non-canonical 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()static booleanisAmbiguous(EnumSet<UriCompliance.Violation> violations) 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
-
AMBIGUOUS_VIOLATIONS
-
RFC3986
Compliance mode that exactly follows RFC3986, excluding all URI Violations. -
UNAMBIGUOUS
Compliance mode that allows all unambiguous violations. -
DEFAULT
-
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. -
UNSAFE
Compliance mode that allows all URI Violations, including allowing ambiguous paths in non-canonical form.
-
-
Constructor Details
-
UriCompliance
-
-
Method Details
-
isAmbiguous
-
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
-