Package org.eclipse.jetty.http
Class ComplianceUtils
java.lang.Object
org.eclipse.jetty.http.ComplianceUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallows(ComplianceViolation.Mode compliance, ComplianceViolation violation, String detail, ComplianceViolation.Listener complianceListener) Check that theComplianceViolationis allowed per the providedComplianceViolation.Mode.static booleanallows(ComplianceViolation.Mode compliance, ComplianceViolation violation, ComplianceViolation.Listener complianceListener) Check that theComplianceViolationis allowed per the providedComplianceViolation.Mode.static voidnotify(ComplianceViolation.Listener complianceListener, ComplianceViolation.Event event) static voidverify(HttpCompliance httpCompliance, MetaData.Request request, ComplianceViolation.Listener listener) Check the provided Request against configuredHttpCompliance.static <T extends Throwable>
voidverify(UriCompliance uriCompliance, HttpURI uri, ComplianceViolation.Listener listener, Function<String, T> error) Verify that theHttpURIhas noUriComplianceviolations..
-
Constructor Details
-
ComplianceUtils
public ComplianceUtils()
-
-
Method Details
-
allows
public static boolean allows(ComplianceViolation.Mode compliance, ComplianceViolation violation, ComplianceViolation.Listener complianceListener) Check that theComplianceViolationis allowed per the providedComplianceViolation.Mode.If a
ComplianceViolation.Listeneris provided, notify it of the check.It is assumed that if you are calling this method, a violation has been detected. The purpose of this method is to check if it is allowed, and also notify that the violation was detected (along with the details and allowed state).
- Parameters:
compliance- the compliance modeviolation- the violationcomplianceListener- the listener to notify (can be null)- Returns:
- true if violation is allowed per the configured compliance.
-
allows
public static boolean allows(ComplianceViolation.Mode compliance, ComplianceViolation violation, String detail, ComplianceViolation.Listener complianceListener) Check that theComplianceViolationis allowed per the providedComplianceViolation.Mode.If a
ComplianceViolation.Listeneris provided, notify it of the check.It is assumed that if you are calling this method, a violation has been detected. The purpose of this method is to check if it is allowed, and also notify that the violation was detected (along with the details and allowed state).
- Parameters:
compliance- the compliance modeviolation- the violationdetail- the detail of the violationcomplianceListener- the listener to notify (can be null)- Returns:
- true if violation is allowed per the configured compliance.
-
notify
public static void notify(ComplianceViolation.Listener complianceListener, ComplianceViolation.Event event) -
verify
public static <T extends Throwable> void verify(UriCompliance uriCompliance, HttpURI uri, ComplianceViolation.Listener listener, Function<String, T> error) throws TVerify that theHttpURIhas noUriComplianceviolations..- Type Parameters:
T- the type of Throwable- Parameters:
uriCompliance- the configured UriCompliance to applyuri- the HttpURI to check for violationslistener- the listener to report toerror- the function to produce a Throwable if not allowed- Throws:
T- Throwable if not allowed
-
verify
public static void verify(HttpCompliance httpCompliance, MetaData.Request request, ComplianceViolation.Listener listener) Check the provided Request against configuredHttpCompliance.- Parameters:
httpCompliance- the HttpCompliance to use.request- the request to checklistener- the notification method for violations. (Tip: use the Request specific Listener from theHttpChannelState)- Throws:
HttpException.RuntimeException- if there is a violation that wasn't allowed
-