Package org.eclipse.jetty.http
Class HttpCompliance
java.lang.Object
org.eclipse.jetty.http.HttpCompliance
- All Implemented Interfaces:
ComplianceViolation.Mode
HTTP compliance modes for Jetty HTTP parsing and handling.
A Compliance mode consists of a set of
HttpCompliance.Violations which are applied
when the mode is enabled.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpComplianceA legacy HttpCompliance mode that allows all violations except case-insensitive methods.protected static final org.slf4j.Loggerstatic final HttpCompliancestatic final HttpComplianceA legacy HttpCompliance mode that supportsRFC2616, but that also allows: case-insensitive methods; colons after field names;Transfer-EncodingwithContent-Lengthfields; and multipleContent-Lengthvalues.static final HttpComplianceThe HttpCompliance mode that supports RFC 7230 with no known violations.static final HttpComplianceA legacy HttpCompliance mode that supportsRFC7230, but with case-insensitive methods allowed.static final StringThe request attribute which may be set to record any allowed HTTP violations. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallows(ComplianceViolation violation) static HttpComplianceCreate compliance mode from a String description.getKnown()getName()toString()static HttpComplianceGet a known compliance mode by name.with(String name, HttpCompliance.Violation... violations) Create a new HttpCompliance mode that includes the passedHttpCompliance.Violations.without(String name, HttpCompliance.Violation... violations) Create a new HttpCompliance mode that excludes the passedHttpCompliance.Violations.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
VIOLATIONS_ATTR
The request attribute which may be set to record any allowed HTTP violations.- See Also:
-
RFC7230
The HttpCompliance mode that supports RFC 7230 with no known violations. -
RFC2616
-
LEGACY
A legacy HttpCompliance mode that allows all violations except case-insensitive methods. -
RFC2616_LEGACY
A legacy HttpCompliance mode that supportsRFC2616, but that also allows: case-insensitive methods; colons after field names;Transfer-EncodingwithContent-Lengthfields; and multipleContent-Lengthvalues. -
RFC7230_LEGACY
A legacy HttpCompliance mode that supportsRFC7230, but with case-insensitive methods allowed.
-
-
Method Details
-
valueOf
Get a known compliance mode by name.- Parameters:
name- The name of a knownHttpCompliancemode.- Returns:
- The mode matching the name.
-
from
Create compliance mode from a String description.Format:
- 0
- No
HttpCompliance.Violations - *
- All
HttpCompliance.Violations - RFC2616
- The set of
HttpCompliance.Violations application to https://tools.ietf.org/html/rfc2616, but not https://tools.ietf.org/html/rfc7230 - RFC7230
- The set of
HttpCompliance.Violations application to https://tools.ietf.org/html/rfc7230 - name
- Any of the known modes defined in
KNOWN_MODES
The remainder of the list can contain then names of
HttpCompliance.Violations to include them in the mode, or prefixed with a '-' to exclude them from the mode.- Parameters:
spec- A string describing the compliance- Returns:
- the HttpCompliance 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
- Specified by:
getAllowedin interfaceComplianceViolation.Mode- Returns:
- The immutable set of violations allowed by this mode.
-
getKnown
- Specified by:
getKnownin interfaceComplianceViolation.Mode- Returns:
- The immutable set of all known violations for this mode.
-
with
Create a new HttpCompliance mode that includes the passedHttpCompliance.Violations.- Parameters:
name- The name of the new modeviolations- The violations to include- Returns:
- A new
HttpCompliancemode.
-
without
Create a new HttpCompliance mode that excludes the passedHttpCompliance.Violations.- Parameters:
name- The name of the new modeviolations- The violations to exclude- Returns:
- A new
HttpCompliancemode.
-
toString
-