Class ResponsePredicate
- All Implemented Interfaces:
MutinyDelegate,Function<HttpResponse<Void>,ResponsePredicateResult>
By default, a Vert.x Web Client request ends with an error only if something wrong happens at the network level.
In other words, a 404 Not Found response, or a response with the wrong content type, are NOT considered as failures.
Response predicates can fail a request when the response does not match some criteria.
Custom predicate instances can be used with .
As a convenience, a few predicates for common uses cases are predefined. For example:
ResponsePredicateto verify that the response has a2xxcode, orResponsePredicateto verify that the response body contains JSON data.- ...
However, you can create a new ResponsePredicate instance from an existing one using create(java.util.function.Function<io.vertx.mutiny.ext.web.client.HttpResponse<java.lang.Void>, io.vertx.mutiny.ext.web.client.predicate.ResponsePredicateResult>) or
create(java.util.function.Function<io.vertx.mutiny.ext.web.client.HttpResponse<java.lang.Void>, io.vertx.mutiny.ext.web.client.predicate.ResponsePredicateResult>) when the body is required to build the validation failure.
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeArg<ResponsePredicate>Deprecated.static final ResponsePredicateDeprecated.Creates a predicate validating the responsecontent-typeisapplication/json.static final ResponsePredicateDeprecated.202 Acceptedstatic final ResponsePredicateDeprecated.502 Bad Gatewaystatic final ResponsePredicateDeprecated.400 Bad Requeststatic final ResponsePredicateDeprecated.Any 4XX client errorstatic final ResponsePredicateDeprecated.409 Conflictstatic final ResponsePredicateDeprecated.100 Continuestatic final ResponsePredicateDeprecated.201 Createdstatic final ResponsePredicateDeprecated.103 Early Hintsstatic final ResponsePredicateDeprecated.417 Expectation Failedstatic final ResponsePredicateDeprecated.424 Failed Dependency (WebDAV, RFC4918)static final ResponsePredicateDeprecated.403 Forbiddenstatic final ResponsePredicateDeprecated.302 Foundstatic final ResponsePredicateDeprecated.504 Gateway Timeoutstatic final ResponsePredicateDeprecated.410 Gonestatic final ResponsePredicateDeprecated.505 HTTP Version Not Supportedstatic final ResponsePredicateDeprecated.Any 1XX informational responsestatic final ResponsePredicateDeprecated.507 Insufficient Storage (WebDAV, RFC4918)static final ResponsePredicateDeprecated.500 Internal Server Errorstatic final ResponsePredicateDeprecated.411 Length Requiredstatic final ResponsePredicateDeprecated.423 Locked (WebDAV, RFC4918)static final ResponsePredicateDeprecated.405 Method Not Allowedstatic final ResponsePredicateDeprecated.421 Misdirected Requeststatic final ResponsePredicateDeprecated.301 Moved Permanentlystatic final ResponsePredicateDeprecated.207 Multi-Status (WebDAV, RFC2518)static final ResponsePredicateDeprecated.300 Multiple Choicesstatic final ResponsePredicateDeprecated.511 Network Authentication Required (RFC6585)static final ResponsePredicateDeprecated.204 No Contentstatic final ResponsePredicateDeprecated.203 Non-Authoritative Information (since HTTP/1.1)static final ResponsePredicateDeprecated.406 Not Acceptablestatic final ResponsePredicateDeprecated.510 Not Extended (RFC2774)static final ResponsePredicateDeprecated.404 Not Foundstatic final ResponsePredicateDeprecated.501 Not Implementedstatic final ResponsePredicateDeprecated.304 Not Modifiedstatic final ResponsePredicateDeprecated.200 OKstatic final ResponsePredicateDeprecated.206 Partial Contentstatic final ResponsePredicateDeprecated.402 Payment Requiredstatic final ResponsePredicateDeprecated.308 Permanent Redirect (RFC7538)static final ResponsePredicateDeprecated.412 Precondition Failedstatic final ResponsePredicateDeprecated.428 Precondition Required (RFC6585)static final ResponsePredicateDeprecated.102 Processing (WebDAV, RFC2518)static final ResponsePredicateDeprecated.407 Proxy Authentication Requiredstatic final ResponsePredicateDeprecated.Any 3XX redirectionstatic final ResponsePredicateDeprecated.413 Request Entity Too Largestatic final ResponsePredicateDeprecated.431 Request Header Fields Too Large (RFC6585)static final ResponsePredicateDeprecated.408 Request Timeoutstatic final ResponsePredicateDeprecated.414 Request-URI Too Longstatic final ResponsePredicateDeprecated.416 Requested Range Not Satisfiablestatic final ResponsePredicateDeprecated.205 Reset Contentstatic final ResponsePredicateDeprecated.303 See Other (since HTTP/1.1)static final ResponsePredicateDeprecated.Any 5XX server errorstatic final ResponsePredicateDeprecated.503 Service Unavailablestatic final ResponsePredicateDeprecated.Any 2XX successstatic final ResponsePredicateDeprecated.101 Switching Protocolsstatic final ResponsePredicateDeprecated.307 Temporary Redirect (since HTTP/1.1)static final ResponsePredicateDeprecated.429 Too Many Requests (RFC6585)static final ResponsePredicateDeprecated.401 Unauthorizedstatic final ResponsePredicateDeprecated.425 Unordered Collection (WebDAV, RFC3648)static final ResponsePredicateDeprecated.422 Unprocessable Entity (WebDAV, RFC4918)static final ResponsePredicateDeprecated.415 Unsupported Media Typestatic final ResponsePredicateDeprecated.426 Upgrade Required (RFC2817)static final ResponsePredicateDeprecated.305 Use Proxy (since HTTP/1.1)static final ResponsePredicateDeprecated.506 Variant Also Negotiates (RFC2295) -
Constructor Summary
ConstructorsConstructorDescriptionResponsePredicate(io.vertx.ext.web.client.predicate.ResponsePredicate delegate) Deprecated.ResponsePredicate(Object delegate) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionapply(HttpResponse<Void> in) Deprecated.static ResponsePredicatecontentType(String mimeType) Deprecated.static ResponsePredicatecontentType(List<String> mimeTypes) Deprecated.static ResponsePredicateDeprecated.static ResponsePredicatecreate(Function<HttpResponse<Void>, ResponsePredicateResult> test, ErrorConverter errorConverter) Deprecated.booleanDeprecated.Deprecated.io.vertx.ext.web.client.predicate.ResponsePredicateDeprecated.inthashCode()Deprecated.static ResponsePredicatenewInstance(io.vertx.ext.web.client.predicate.ResponsePredicate arg) Deprecated.static ResponsePredicatestatus(int statusCode) Deprecated.static ResponsePredicatestatus(int min, int max) Deprecated.toString()Deprecated.
-
Field Details
-
__TYPE_ARG
Deprecated. -
SC_INFORMATIONAL_RESPONSE
Deprecated.Any 1XX informational response -
SC_CONTINUE
Deprecated.100 Continue -
SC_SWITCHING_PROTOCOLS
Deprecated.101 Switching Protocols -
SC_PROCESSING
Deprecated.102 Processing (WebDAV, RFC2518) -
SC_EARLY_HINTS
Deprecated.103 Early Hints -
SC_SUCCESS
Deprecated.Any 2XX success -
SC_OK
Deprecated.200 OK -
SC_CREATED
Deprecated.201 Created -
SC_ACCEPTED
Deprecated.202 Accepted -
SC_NON_AUTHORITATIVE_INFORMATION
Deprecated.203 Non-Authoritative Information (since HTTP/1.1) -
SC_NO_CONTENT
Deprecated.204 No Content -
SC_RESET_CONTENT
Deprecated.205 Reset Content -
SC_PARTIAL_CONTENT
Deprecated.206 Partial Content -
SC_MULTI_STATUS
Deprecated.207 Multi-Status (WebDAV, RFC2518) -
SC_REDIRECTION
Deprecated.Any 3XX redirection -
SC_MULTIPLE_CHOICES
Deprecated.300 Multiple Choices -
SC_MOVED_PERMANENTLY
Deprecated.301 Moved Permanently -
SC_FOUND
Deprecated.302 Found -
SC_SEE_OTHER
Deprecated.303 See Other (since HTTP/1.1) -
SC_NOT_MODIFIED
Deprecated.304 Not Modified -
SC_USE_PROXY
Deprecated.305 Use Proxy (since HTTP/1.1) -
SC_TEMPORARY_REDIRECT
Deprecated.307 Temporary Redirect (since HTTP/1.1) -
SC_PERMANENT_REDIRECT
Deprecated.308 Permanent Redirect (RFC7538) -
SC_CLIENT_ERRORS
Deprecated.Any 4XX client error -
SC_BAD_REQUEST
Deprecated.400 Bad Request -
SC_UNAUTHORIZED
Deprecated.401 Unauthorized -
SC_PAYMENT_REQUIRED
Deprecated.402 Payment Required -
SC_FORBIDDEN
Deprecated.403 Forbidden -
SC_NOT_FOUND
Deprecated.404 Not Found -
SC_METHOD_NOT_ALLOWED
Deprecated.405 Method Not Allowed -
SC_NOT_ACCEPTABLE
Deprecated.406 Not Acceptable -
SC_PROXY_AUTHENTICATION_REQUIRED
Deprecated.407 Proxy Authentication Required -
SC_REQUEST_TIMEOUT
Deprecated.408 Request Timeout -
SC_CONFLICT
Deprecated.409 Conflict -
SC_GONE
Deprecated.410 Gone -
SC_LENGTH_REQUIRED
Deprecated.411 Length Required -
SC_PRECONDITION_FAILED
Deprecated.412 Precondition Failed -
SC_REQUEST_ENTITY_TOO_LARGE
Deprecated.413 Request Entity Too Large -
SC_REQUEST_URI_TOO_LONG
Deprecated.414 Request-URI Too Long -
SC_UNSUPPORTED_MEDIA_TYPE
Deprecated.415 Unsupported Media Type -
SC_REQUESTED_RANGE_NOT_SATISFIABLE
Deprecated.416 Requested Range Not Satisfiable -
SC_EXPECTATION_FAILED
Deprecated.417 Expectation Failed -
SC_MISDIRECTED_REQUEST
Deprecated.421 Misdirected Request -
SC_UNPROCESSABLE_ENTITY
Deprecated.422 Unprocessable Entity (WebDAV, RFC4918) -
SC_LOCKED
Deprecated.423 Locked (WebDAV, RFC4918) -
SC_FAILED_DEPENDENCY
Deprecated.424 Failed Dependency (WebDAV, RFC4918) -
SC_UNORDERED_COLLECTION
Deprecated.425 Unordered Collection (WebDAV, RFC3648) -
SC_UPGRADE_REQUIRED
Deprecated.426 Upgrade Required (RFC2817) -
SC_PRECONDITION_REQUIRED
Deprecated.428 Precondition Required (RFC6585) -
SC_TOO_MANY_REQUESTS
Deprecated.429 Too Many Requests (RFC6585) -
SC_REQUEST_HEADER_FIELDS_TOO_LARGE
Deprecated.431 Request Header Fields Too Large (RFC6585) -
SC_SERVER_ERRORS
Deprecated.Any 5XX server error -
SC_INTERNAL_SERVER_ERROR
Deprecated.500 Internal Server Error -
SC_NOT_IMPLEMENTED
Deprecated.501 Not Implemented -
SC_BAD_GATEWAY
Deprecated.502 Bad Gateway -
SC_SERVICE_UNAVAILABLE
Deprecated.503 Service Unavailable -
SC_GATEWAY_TIMEOUT
Deprecated.504 Gateway Timeout -
SC_HTTP_VERSION_NOT_SUPPORTED
Deprecated.505 HTTP Version Not Supported -
SC_VARIANT_ALSO_NEGOTIATES
Deprecated.506 Variant Also Negotiates (RFC2295) -
SC_INSUFFICIENT_STORAGE
Deprecated.507 Insufficient Storage (WebDAV, RFC4918) -
SC_NOT_EXTENDED
Deprecated.510 Not Extended (RFC2774) -
SC_NETWORK_AUTHENTICATION_REQUIRED
Deprecated.511 Network Authentication Required (RFC6585) -
JSON
Deprecated.Creates a predicate validating the responsecontent-typeisapplication/json.
-
-
Constructor Details
-
ResponsePredicate
public ResponsePredicate(io.vertx.ext.web.client.predicate.ResponsePredicate delegate) Deprecated. -
ResponsePredicate
Deprecated.
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.client.predicate.ResponsePredicate getDelegate()Deprecated.- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
Deprecated. -
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
apply
Deprecated.- Specified by:
applyin interfaceFunction<HttpResponse<Void>,ResponsePredicateResult>
-
status
Deprecated.- Parameters:
statusCode- the expected status code- Returns:
-
status
Deprecated.- Parameters:
min- the lower (inclusive) accepted status codemax- the highest (exclusive) accepted status code- Returns:
-
contentType
Deprecated.- Parameters:
mimeType- the mime type- Returns:
-
contentType
Deprecated.- Parameters:
mimeTypes- the list of mime types- Returns:
-
create
@Deprecated public static ResponsePredicate create(Function<HttpResponse<Void>, ResponsePredicateResult> test) Deprecated.- Parameters:
test- the function to invoke when the response is received- Returns:
-
create
@Deprecated public static ResponsePredicate create(Function<HttpResponse<Void>, ResponsePredicateResult> test, ErrorConverter errorConverter) Deprecated.- Parameters:
test- the function to invoke when the response is receivederrorConverter- converts the result of thetestfunction to aThrowable- Returns:
-
errorConverter
Deprecated.- Returns:
- the error converter currently used
-
newInstance
public static ResponsePredicate newInstance(io.vertx.ext.web.client.predicate.ResponsePredicate arg) Deprecated.
-