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.Violation
s which are applied
when the mode is enabled.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HttpCompliance
A legacy HttpCompliance mode that allows all violations except case-insensitive methods.protected static final org.slf4j.Logger
static final HttpCompliance
static final HttpCompliance
A legacy HttpCompliance mode that supportsRFC2616
, but that also allows: case-insensitive methods; colons after field names;Transfer-Encoding
withContent-Length
fields; and multipleContent-Length
values.static final HttpCompliance
The HttpCompliance mode that supports RFC 7230 with no known violations.static final HttpCompliance
A legacy HttpCompliance mode that supportsRFC7230
, but with case-insensitive methods allowed.static final String
The request attribute which may be set to record any allowed HTTP violations. -
Method Summary
Modifier and TypeMethodDescriptionboolean
allows
(ComplianceViolation violation) static HttpCompliance
Create compliance mode from a String description.getKnown()
getName()
toString()
static HttpCompliance
Get a known compliance mode by name.with
(String name, HttpCompliance.Violation... violations) Create a new HttpCompliance mode that includes the passedHttpCompliance.Violation
s.without
(String name, HttpCompliance.Violation... violations) Create a new HttpCompliance mode that excludes the passedHttpCompliance.Violation
s.
-
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-Encoding
withContent-Length
fields; and multipleContent-Length
values. -
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 knownHttpCompliance
mode.- Returns:
- The mode matching the name.
-
from
Create compliance mode from a String description.Format:
- 0
- No
HttpCompliance.Violation
s - *
- All
HttpCompliance.Violation
s - RFC2616
- The set of
HttpCompliance.Violation
s application to https://tools.ietf.org/html/rfc2616, but not https://tools.ietf.org/html/rfc7230 - RFC7230
- The set of
HttpCompliance.Violation
s 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.Violation
s 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:
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
- Specified by:
getAllowed
in interfaceComplianceViolation.Mode
- Returns:
- The immutable set of violations allowed by this mode.
-
getKnown
- Specified by:
getKnown
in interfaceComplianceViolation.Mode
- Returns:
- The immutable set of all known violations for this mode.
-
with
Create a new HttpCompliance mode that includes the passedHttpCompliance.Violation
s.- Parameters:
name
- The name of the new modeviolations
- The violations to include- Returns:
- A new
HttpCompliance
mode.
-
without
Create a new HttpCompliance mode that excludes the passedHttpCompliance.Violation
s.- Parameters:
name
- The name of the new modeviolations
- The violations to exclude- Returns:
- A new
HttpCompliance
mode.
-
toString
-