io.vertx.reactivex.ext.web.client.predicate

## Class ResponsePredicate

- java.lang.Object
- - io.vertx.reactivex.ext.web.client.predicate.ResponsePredicate

- All Implemented Interfaces:
    java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult>

      public class ResponsePredicate
      extends Object
      implements java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult>

  A predicate on .

  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:

  - `ResponsePredicate` to verify that the response has a `2xx` code, or
  - `ResponsePredicate` to verify that the response body contains JSON data.
  - ...
  Predefined predicates use the default error converter (discarding the body).

  However, you can create a new `ResponsePredicate` instance from an existing one using `create(java.util.function.Function<io.vertx.reactivex.ext.web.client.HttpResponse<java.lang.Void>, io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult>)` or `create(java.util.function.Function<io.vertx.reactivex.ext.web.client.HttpResponse<java.lang.Void>, io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult>)` when the body is required to build the validation failure.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<ResponsePredicate>` | `__TYPE_ARG`
    `static ResponsePredicate` | `JSON` Creates a predicate validating the response `content-type` is `application/json`.
    `static ResponsePredicate` | `SC_ACCEPTED` 202 Accepted
    `static ResponsePredicate` | `SC_BAD_GATEWAY` 502 Bad Gateway
    `static ResponsePredicate` | `SC_BAD_REQUEST` 400 Bad Request
    `static ResponsePredicate` | `SC_CLIENT_ERRORS` Any 4XX client error
    `static ResponsePredicate` | `SC_CONFLICT` 409 Conflict
    `static ResponsePredicate` | `SC_CONTINUE` 100 Continue
    `static ResponsePredicate` | `SC_CREATED` 201 Created
    `static ResponsePredicate` | `SC_EARLY_HINTS` 103 Early Hints
    `static ResponsePredicate` | `SC_EXPECTATION_FAILED` 417 Expectation Failed
    `static ResponsePredicate` | `SC_FAILED_DEPENDENCY` 424 Failed Dependency (WebDAV, RFC4918)
    `static ResponsePredicate` | `SC_FORBIDDEN` 403 Forbidden
    `static ResponsePredicate` | `SC_FOUND` 302 Found
    `static ResponsePredicate` | `SC_GATEWAY_TIMEOUT` 504 Gateway Timeout
    `static ResponsePredicate` | `SC_GONE` 410 Gone
    `static ResponsePredicate` | `SC_HTTP_VERSION_NOT_SUPPORTED` 505 HTTP Version Not Supported
    `static ResponsePredicate` | `SC_INFORMATIONAL_RESPONSE` Any 1XX informational response
    `static ResponsePredicate` | `SC_INSUFFICIENT_STORAGE` 507 Insufficient Storage (WebDAV, RFC4918)
    `static ResponsePredicate` | `SC_INTERNAL_SERVER_ERROR` 500 Internal Server Error
    `static ResponsePredicate` | `SC_LENGTH_REQUIRED` 411 Length Required
    `static ResponsePredicate` | `SC_LOCKED` 423 Locked (WebDAV, RFC4918)
    `static ResponsePredicate` | `SC_METHOD_NOT_ALLOWED` 405 Method Not Allowed
    `static ResponsePredicate` | `SC_MISDIRECTED_REQUEST` 421 Misdirected Request
    `static ResponsePredicate` | `SC_MOVED_PERMANENTLY` 301 Moved Permanently
    `static ResponsePredicate` | `SC_MULTI_STATUS` 207 Multi-Status (WebDAV, RFC2518)
    `static ResponsePredicate` | `SC_MULTIPLE_CHOICES` 300 Multiple Choices
    `static ResponsePredicate` | `SC_NETWORK_AUTHENTICATION_REQUIRED` 511 Network Authentication Required (RFC6585)
    `static ResponsePredicate` | `SC_NO_CONTENT` 204 No Content
    `static ResponsePredicate` | `SC_NON_AUTHORITATIVE_INFORMATION` 203 Non-Authoritative Information (since HTTP/1.1)
    `static ResponsePredicate` | `SC_NOT_ACCEPTABLE` 406 Not Acceptable
    `static ResponsePredicate` | `SC_NOT_EXTENDED` 510 Not Extended (RFC2774)
    `static ResponsePredicate` | `SC_NOT_FOUND` 404 Not Found
    `static ResponsePredicate` | `SC_NOT_IMPLEMENTED` 501 Not Implemented
    `static ResponsePredicate` | `SC_NOT_MODIFIED` 304 Not Modified
    `static ResponsePredicate` | `SC_OK` 200 OK
    `static ResponsePredicate` | `SC_PARTIAL_CONTENT` 206 Partial Content
    `static ResponsePredicate` | `SC_PAYMENT_REQUIRED` 402 Payment Required
    `static ResponsePredicate` | `SC_PERMANENT_REDIRECT` 308 Permanent Redirect (RFC7538)
    `static ResponsePredicate` | `SC_PRECONDITION_FAILED` 412 Precondition Failed
    `static ResponsePredicate` | `SC_PRECONDITION_REQUIRED` 428 Precondition Required (RFC6585)
    `static ResponsePredicate` | `SC_PROCESSING` 102 Processing (WebDAV, RFC2518)
    `static ResponsePredicate` | `SC_PROXY_AUTHENTICATION_REQUIRED` 407 Proxy Authentication Required
    `static ResponsePredicate` | `SC_REDIRECTION` Any 3XX redirection
    `static ResponsePredicate` | `SC_REQUEST_ENTITY_TOO_LARGE` 413 Request Entity Too Large
    `static ResponsePredicate` | `SC_REQUEST_HEADER_FIELDS_TOO_LARGE` 431 Request Header Fields Too Large (RFC6585)
    `static ResponsePredicate` | `SC_REQUEST_TIMEOUT` 408 Request Timeout
    `static ResponsePredicate` | `SC_REQUEST_URI_TOO_LONG` 414 Request-URI Too Long
    `static ResponsePredicate` | `SC_REQUESTED_RANGE_NOT_SATISFIABLE` 416 Requested Range Not Satisfiable
    `static ResponsePredicate` | `SC_RESET_CONTENT` 205 Reset Content
    `static ResponsePredicate` | `SC_SEE_OTHER` 303 See Other (since HTTP/1.1)
    `static ResponsePredicate` | `SC_SERVER_ERRORS` Any 5XX server error
    `static ResponsePredicate` | `SC_SERVICE_UNAVAILABLE` 503 Service Unavailable
    `static ResponsePredicate` | `SC_SUCCESS` Any 2XX success
    `static ResponsePredicate` | `SC_SWITCHING_PROTOCOLS` 101 Switching Protocols
    `static ResponsePredicate` | `SC_TEMPORARY_REDIRECT` 307 Temporary Redirect (since HTTP/1.1)
    `static ResponsePredicate` | `SC_TOO_MANY_REQUESTS` 429 Too Many Requests (RFC6585)
    `static ResponsePredicate` | `SC_UNAUTHORIZED` 401 Unauthorized
    `static ResponsePredicate` | `SC_UNORDERED_COLLECTION` 425 Unordered Collection (WebDAV, RFC3648)
    `static ResponsePredicate` | `SC_UNPROCESSABLE_ENTITY` 422 Unprocessable Entity (WebDAV, RFC4918)
    `static ResponsePredicate` | `SC_UNSUPPORTED_MEDIA_TYPE` 415 Unsupported Media Type
    `static ResponsePredicate` | `SC_UPGRADE_REQUIRED` 426 Upgrade Required (RFC2817)
    `static ResponsePredicate` | `SC_USE_PROXY` 305 Use Proxy (since HTTP/1.1)
    `static ResponsePredicate` | `SC_VARIANT_ALSO_NEGOTIATES` 506 Variant Also Negotiates (RFC2295)

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResponsePredicate(Object delegate)`
    `ResponsePredicate(ResponsePredicate delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ResponsePredicateResult` | `apply(HttpResponse<Void> in)`
    `static ResponsePredicate` | `contentType(List<String> mimeTypes)` Creates a predicate validating the response has a `content-type` header matching one of the `mimeTypes`.
    `static ResponsePredicate` | `contentType(String mimeType)` Creates a predicate validating the response has a `content-type` header matching the `mimeType`.
    `static ResponsePredicate` | `create(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> test)` Creates a new `ResponsePredicate`.
    `static ResponsePredicate` | `create(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> test, ErrorConverter errorConverter)` Creates a new `ResponsePredicate`, using a custom `errorConverter`.
    `boolean` | `equals(Object o)`
    `ErrorConverter` | `errorConverter()`
    `ResponsePredicate` | `getDelegate()`
    `int` | `hashCode()`
    `static ResponsePredicate` | `newInstance(ResponsePredicate arg)`
    `static ResponsePredicate` | `status(int statusCode)` Creates a predicate asserting that the status response code is equal to `statusCode`.
    `static ResponsePredicate` | `status(int min, int max)` Creates a predicate asserting that the status response code is in the `[min,max[` range.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.function.Function

      `andThen, compose, identity`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<ResponsePredicate> __TYPE_ARG

    - #### SC_INFORMATIONAL_RESPONSE

          public static final ResponsePredicate SC_INFORMATIONAL_RESPONSE

      Any 1XX informational response

    - #### SC_CONTINUE

          public static final ResponsePredicate SC_CONTINUE

      100 Continue

    - #### SC_SWITCHING_PROTOCOLS

          public static final ResponsePredicate SC_SWITCHING_PROTOCOLS

      101 Switching Protocols

    - #### SC_PROCESSING

          public static final ResponsePredicate SC_PROCESSING

      102 Processing (WebDAV, RFC2518)

    - #### SC_EARLY_HINTS

          public static final ResponsePredicate SC_EARLY_HINTS

      103 Early Hints

    - #### SC_SUCCESS

          public static final ResponsePredicate SC_SUCCESS

      Any 2XX success

    - #### SC_OK

          public static final ResponsePredicate SC_OK

      200 OK

    - #### SC_CREATED

          public static final ResponsePredicate SC_CREATED

      201 Created

    - #### SC_ACCEPTED

          public static final ResponsePredicate SC_ACCEPTED

      202 Accepted

    - #### SC_NON_AUTHORITATIVE_INFORMATION

          public static final ResponsePredicate SC_NON_AUTHORITATIVE_INFORMATION

      203 Non-Authoritative Information (since HTTP/1.1)

    - #### SC_NO_CONTENT

          public static final ResponsePredicate SC_NO_CONTENT

      204 No Content

    - #### SC_RESET_CONTENT

          public static final ResponsePredicate SC_RESET_CONTENT

      205 Reset Content

    - #### SC_PARTIAL_CONTENT

          public static final ResponsePredicate SC_PARTIAL_CONTENT

      206 Partial Content

    - #### SC_MULTI_STATUS

          public static final ResponsePredicate SC_MULTI_STATUS

      207 Multi-Status (WebDAV, RFC2518)

    - #### SC_REDIRECTION

          public static final ResponsePredicate SC_REDIRECTION

      Any 3XX redirection

    - #### SC_MULTIPLE_CHOICES

          public static final ResponsePredicate SC_MULTIPLE_CHOICES

      300 Multiple Choices

    - #### SC_MOVED_PERMANENTLY

          public static final ResponsePredicate SC_MOVED_PERMANENTLY

      301 Moved Permanently

    - #### SC_FOUND

          public static final ResponsePredicate SC_FOUND

      302 Found

    - #### SC_SEE_OTHER

          public static final ResponsePredicate SC_SEE_OTHER

      303 See Other (since HTTP/1.1)

    - #### SC_NOT_MODIFIED

          public static final ResponsePredicate SC_NOT_MODIFIED

      304 Not Modified

    - #### SC_USE_PROXY

          public static final ResponsePredicate SC_USE_PROXY

      305 Use Proxy (since HTTP/1.1)

    - #### SC_TEMPORARY_REDIRECT

          public static final ResponsePredicate SC_TEMPORARY_REDIRECT

      307 Temporary Redirect (since HTTP/1.1)

    - #### SC_PERMANENT_REDIRECT

          public static final ResponsePredicate SC_PERMANENT_REDIRECT

      308 Permanent Redirect (RFC7538)

    - #### SC_CLIENT_ERRORS

          public static final ResponsePredicate SC_CLIENT_ERRORS

      Any 4XX client error

    - #### SC_BAD_REQUEST

          public static final ResponsePredicate SC_BAD_REQUEST

      400 Bad Request

    - #### SC_UNAUTHORIZED

          public static final ResponsePredicate SC_UNAUTHORIZED

      401 Unauthorized

    - #### SC_PAYMENT_REQUIRED

          public static final ResponsePredicate SC_PAYMENT_REQUIRED

      402 Payment Required

    - #### SC_FORBIDDEN

          public static final ResponsePredicate SC_FORBIDDEN

      403 Forbidden

    - #### SC_NOT_FOUND

          public static final ResponsePredicate SC_NOT_FOUND

      404 Not Found

    - #### SC_METHOD_NOT_ALLOWED

          public static final ResponsePredicate SC_METHOD_NOT_ALLOWED

      405 Method Not Allowed

    - #### SC_NOT_ACCEPTABLE

          public static final ResponsePredicate SC_NOT_ACCEPTABLE

      406 Not Acceptable

    - #### SC_PROXY_AUTHENTICATION_REQUIRED

          public static final ResponsePredicate SC_PROXY_AUTHENTICATION_REQUIRED

      407 Proxy Authentication Required

    - #### SC_REQUEST_TIMEOUT

          public static final ResponsePredicate SC_REQUEST_TIMEOUT

      408 Request Timeout

    - #### SC_CONFLICT

          public static final ResponsePredicate SC_CONFLICT

      409 Conflict

    - #### SC_GONE

          public static final ResponsePredicate SC_GONE

      410 Gone

    - #### SC_LENGTH_REQUIRED

          public static final ResponsePredicate SC_LENGTH_REQUIRED

      411 Length Required

    - #### SC_PRECONDITION_FAILED

          public static final ResponsePredicate SC_PRECONDITION_FAILED

      412 Precondition Failed

    - #### SC_REQUEST_ENTITY_TOO_LARGE

          public static final ResponsePredicate SC_REQUEST_ENTITY_TOO_LARGE

      413 Request Entity Too Large

    - #### SC_REQUEST_URI_TOO_LONG

          public static final ResponsePredicate SC_REQUEST_URI_TOO_LONG

      414 Request-URI Too Long

    - #### SC_UNSUPPORTED_MEDIA_TYPE

          public static final ResponsePredicate SC_UNSUPPORTED_MEDIA_TYPE

      415 Unsupported Media Type

    - #### SC_REQUESTED_RANGE_NOT_SATISFIABLE

          public static final ResponsePredicate SC_REQUESTED_RANGE_NOT_SATISFIABLE

      416 Requested Range Not Satisfiable

    - #### SC_EXPECTATION_FAILED

          public static final ResponsePredicate SC_EXPECTATION_FAILED

      417 Expectation Failed

    - #### SC_MISDIRECTED_REQUEST

          public static final ResponsePredicate SC_MISDIRECTED_REQUEST

      421 Misdirected Request

    - #### SC_UNPROCESSABLE_ENTITY

          public static final ResponsePredicate SC_UNPROCESSABLE_ENTITY

      422 Unprocessable Entity (WebDAV, RFC4918)

    - #### SC_LOCKED

          public static final ResponsePredicate SC_LOCKED

      423 Locked (WebDAV, RFC4918)

    - #### SC_FAILED_DEPENDENCY

          public static final ResponsePredicate SC_FAILED_DEPENDENCY

      424 Failed Dependency (WebDAV, RFC4918)

    - #### SC_UNORDERED_COLLECTION

          public static final ResponsePredicate SC_UNORDERED_COLLECTION

      425 Unordered Collection (WebDAV, RFC3648)

    - #### SC_UPGRADE_REQUIRED

          public static final ResponsePredicate SC_UPGRADE_REQUIRED

      426 Upgrade Required (RFC2817)

    - #### SC_PRECONDITION_REQUIRED

          public static final ResponsePredicate SC_PRECONDITION_REQUIRED

      428 Precondition Required (RFC6585)

    - #### SC_TOO_MANY_REQUESTS

          public static final ResponsePredicate SC_TOO_MANY_REQUESTS

      429 Too Many Requests (RFC6585)

    - #### SC_REQUEST_HEADER_FIELDS_TOO_LARGE

          public static final ResponsePredicate SC_REQUEST_HEADER_FIELDS_TOO_LARGE

      431 Request Header Fields Too Large (RFC6585)

    - #### SC_SERVER_ERRORS

          public static final ResponsePredicate SC_SERVER_ERRORS

      Any 5XX server error

    - #### SC_INTERNAL_SERVER_ERROR

          public static final ResponsePredicate SC_INTERNAL_SERVER_ERROR

      500 Internal Server Error

    - #### SC_NOT_IMPLEMENTED

          public static final ResponsePredicate SC_NOT_IMPLEMENTED

      501 Not Implemented

    - #### SC_BAD_GATEWAY

          public static final ResponsePredicate SC_BAD_GATEWAY

      502 Bad Gateway

    - #### SC_SERVICE_UNAVAILABLE

          public static final ResponsePredicate SC_SERVICE_UNAVAILABLE

      503 Service Unavailable

    - #### SC_GATEWAY_TIMEOUT

          public static final ResponsePredicate SC_GATEWAY_TIMEOUT

      504 Gateway Timeout

    - #### SC_HTTP_VERSION_NOT_SUPPORTED

          public static final ResponsePredicate SC_HTTP_VERSION_NOT_SUPPORTED

      505 HTTP Version Not Supported

    - #### SC_VARIANT_ALSO_NEGOTIATES

          public static final ResponsePredicate SC_VARIANT_ALSO_NEGOTIATES

      506 Variant Also Negotiates (RFC2295)

    - #### SC_INSUFFICIENT_STORAGE

          public static final ResponsePredicate SC_INSUFFICIENT_STORAGE

      507 Insufficient Storage (WebDAV, RFC4918)

    - #### SC_NOT_EXTENDED

          public static final ResponsePredicate SC_NOT_EXTENDED

      510 Not Extended (RFC2774)

    - #### SC_NETWORK_AUTHENTICATION_REQUIRED

          public static final ResponsePredicate SC_NETWORK_AUTHENTICATION_REQUIRED

      511 Network Authentication Required (RFC6585)

    - #### JSON

          public static final ResponsePredicate JSON

      Creates a predicate validating the response `content-type` is `application/json`.

  - ### Constructor Detail

    - #### ResponsePredicate

          public ResponsePredicate(ResponsePredicate delegate)

    - #### ResponsePredicate

          public ResponsePredicate(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### apply

          public ResponsePredicateResult apply(HttpResponse<Void> in)

      Specified by:
        `apply` in interface `java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult>`

    - #### getDelegate

          public ResponsePredicate getDelegate()

    - #### status

          public static ResponsePredicate status(int statusCode)

      Creates a predicate asserting that the status response code is equal to `statusCode`.
      Parameters:
        `statusCode` - the expected status code
      Returns:

    - #### status

          public static ResponsePredicate status(int min,
                                                 int max)

      Creates a predicate asserting that the status response code is in the `[min,max[` range.
      Parameters:
        `min` - the lower (inclusive) accepted status code
        `max` - the highest (exclusive) accepted status code
      Returns:

    - #### contentType

          public static ResponsePredicate contentType(String mimeType)

      Creates a predicate validating the response has a `content-type` header matching the `mimeType`.
      Parameters:
        `mimeType` - the mime type
      Returns:

    - #### contentType

          public static ResponsePredicate contentType(List<String> mimeTypes)

      Creates a predicate validating the response has a `content-type` header matching one of the `mimeTypes`.
      Parameters:
        `mimeTypes` - the list of mime types
      Returns:

    - #### create

          public static ResponsePredicate create(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> test)

      Creates a new `ResponsePredicate`. The default error converter will be used (discarding the body).
      Parameters:
        `test` - the function to invoke when the response is received
      Returns:

    - #### create

          public static ResponsePredicate create(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> test,
                                                 ErrorConverter errorConverter)

      Creates a new `ResponsePredicate`, using a custom `errorConverter`.
      Parameters:
        `test` - the function to invoke when the response is received
        `errorConverter` - converts the result of the `test` function to a `Throwable`
      Returns:

    - #### errorConverter

          public ErrorConverter errorConverter()

      Returns:
        the error converter currently used

    - #### newInstance

          public static ResponsePredicate newInstance(ResponsePredicate arg)

Copyright © 2023 Eclipse. All rights reserved.