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.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
Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionboolean
allows
(ComplianceViolation violation) static void
checkHttpCompliance
(MetaData.Request request, HttpCompliance mode, ComplianceViolation.Listener listener) 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
-
VIOLATIONS_ATTR
Deprecated, for removal: This API element is subject to removal in a future version.useComplianceViolation.CapturingListener.VIOLATIONS_ATTR_KEY
instead.
(Note: new ATTR captures all Compliance violations, not just HTTP.
Make sure you haveHttpConnectionFactory.setRecordHttpComplianceViolations(true)
.
Also make sure that aComplianceViolation.CapturingListener
has been added as a bean to either theConnector
orServer
for the Attribute to be created.)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 RFC2616, but not RFC7230 - RFC7230
- The set of
HttpCompliance.Violation
s application to 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
-
checkHttpCompliance
public static void checkHttpCompliance(MetaData.Request request, HttpCompliance mode, ComplianceViolation.Listener listener)
-
ComplianceViolation.CapturingListener.VIOLATIONS_ATTR_KEY
instead.(Note: new ATTR captures all Compliance violations, not just HTTP.
Make sure you have
HttpConnectionFactory.setRecordHttpComplianceViolations(true)
.Also make sure that a
ComplianceViolation.CapturingListener
has been added as a bean to either theConnector
orServer
for the Attribute to be created.)