Package com.xebialabs.restito.semantics
Class Condition
java.lang.Object
com.xebialabs.restito.semantics.Condition
- Direct Known Subclasses:
ConditionWithApplicables
Condition is something that can be true or false given the Call.
Also it contains static factory methods. One should feel free to implement own conditions.
Note, that terms URL and URI have the same meaning as inRequest.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConditionAlways falsestatic ConditionAlways truestatic ConditionIf basic authentication is providedbooleanCheck if call satisfies the conditionstatic ConditionJoins many conditions with "and" operationstatic ConditionCustom conditionstatic ConditionWithApplicablesMethod DELETE with given URIstatic ConditionendsWithUri(String uri) URI ends withstatic ConditionWithApplicablesMethod GET with given URIReturns the predicate of conditionstatic ConditionURI starts withstatic Conditionmethod(org.glassfish.grizzly.http.Method m) Checks HTTP methodstatic ConditionNot conditionstatic ConditionChecks HTTP parameters.static ConditionWithApplicablesMethod PATCH with given URIstatic ConditionWithApplicablesMethod POST with given URIstatic ConditionWithApplicablesMethod PUT with given URIstatic ConditionstartsWithUri(String uri) URI starts withstatic ConditionURI exactly equals to the value returned byRequest.getRequestURI()static ConditionURL exactly equals to the value returned byRequest.getRequestURL()static ConditionwithHeader(String key) With header present.static ConditionwithHeader(String key, String... expectedHeaders) With header present and equals.static ConditionContains non-empty POST bodystatic ConditionWith POST body containing stringstatic ConditionwithPostBodyContaining(Pattern pattern) With post body matching patternstatic ConditionwithPostBodyContainingJsonPath(String pattern, Object value) With Valid Json Path.
-
Constructor Details
-
Condition
-
-
Method Details
-
getPredicate
Returns the predicate of condition -
check
Check if call satisfies the condition -
method
Checks HTTP method -
parameter
Checks HTTP parameters. Also work with multi-valued parameters -
uri
URI exactly equals to the value returned byRequest.getRequestURI() -
url
URL exactly equals to the value returned byRequest.getRequestURL() -
endsWithUri
URI ends with -
startsWithUri
URI starts with -
matchesUri
URI starts with -
withPostBody
Contains non-empty POST body -
basicAuth
If basic authentication is provided -
custom
Custom condition -
not
Not condition -
withPostBodyContaining
With POST body containing string -
withPostBodyContaining
With post body matching pattern -
withPostBodyContainingJsonPath
With Valid Json Path. Check to see if incoming path has a valid string value selected via a JSONPath expression. -
withHeader
With header present. Header key is case insensitive. More information here. -
withHeader
With header present and equals. Header key is case insensitive. More information here. -
get
Method GET with given URI -
post
Method POST with given URI -
put
Method PUT with given URI -
delete
Method DELETE with given URI -
patch
Method PATCH with given URI -
alwaysTrue
Always true -
alwaysFalse
Always false -
composite
Joins many conditions with "and" operation
-