io.vertx.ext.web.client.predicate

## Interface ResponsePredicate

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

  Deprecated.
  instead use `HttpResponseExpectation`

      @Deprecated
      public interface ResponsePredicate
      extends java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult>

  A predicate on `HttpResponse`.

  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 `HttpRequest.expect(Function)`.

  As a convenience, a few predicates for common uses cases are predefined. For example:

  - `SC_SUCCESS` to verify that the response has a `2xx` code, or
  - `JSON` 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(Function)` or `create(Function, ErrorConverter)` when the body is required to build the validation failure.

- - ### Field Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ResponsePredicate` | `contentType(List<String> mimeTypes)` Deprecated. Creates a predicate validating the response has a `content-type` header matching one of the `mimeTypes`.
    `static ResponsePredicate` | `contentType(String mimeType)` Deprecated. 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)` Deprecated. Creates a new `ResponsePredicate`.
    `static ResponsePredicate` | `create(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> test, ErrorConverter errorConverter)` Deprecated. Creates a new `ResponsePredicate`, using a custom `errorConverter`.
    `default ErrorConverter` | `errorConverter()` Deprecated.
    `static ResponsePredicate` | `status(int statusCode)` Deprecated. Creates a predicate asserting that the status response code is equal to `statusCode`.
    `static ResponsePredicate` | `status(int min, int max)` Deprecated. Creates a predicate asserting that the status response code is in the `[min,max[` range.

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

      `andThen, apply, compose, identity`

- - ### Field Detail

    - #### SC_INFORMATIONAL_RESPONSE

          static final ResponsePredicate SC_INFORMATIONAL_RESPONSE

      Deprecated.
      Any 1XX informational response

    - #### SC_CONTINUE

          static final ResponsePredicate SC_CONTINUE

      Deprecated.
      100 Continue

    - #### SC_SWITCHING_PROTOCOLS

          static final ResponsePredicate SC_SWITCHING_PROTOCOLS

      Deprecated.
      101 Switching Protocols

    - #### SC_PROCESSING

          static final ResponsePredicate SC_PROCESSING

      Deprecated.
      102 Processing (WebDAV, RFC2518)

    - #### SC_EARLY_HINTS

          static final ResponsePredicate SC_EARLY_HINTS

      Deprecated.
      103 Early Hints

    - #### SC_SUCCESS

          static final ResponsePredicate SC_SUCCESS

      Deprecated.
      Any 2XX success

    - #### SC_OK

          static final ResponsePredicate SC_OK

      Deprecated.
      200 OK

    - #### SC_CREATED

          static final ResponsePredicate SC_CREATED

      Deprecated.
      201 Created

    - #### SC_ACCEPTED

          static final ResponsePredicate SC_ACCEPTED

      Deprecated.
      202 Accepted

    - #### SC_NON_AUTHORITATIVE_INFORMATION

          static final ResponsePredicate SC_NON_AUTHORITATIVE_INFORMATION

      Deprecated.
      203 Non-Authoritative Information (since HTTP/1.1)

    - #### SC_NO_CONTENT

          static final ResponsePredicate SC_NO_CONTENT

      Deprecated.
      204 No Content

    - #### SC_RESET_CONTENT

          static final ResponsePredicate SC_RESET_CONTENT

      Deprecated.
      205 Reset Content

    - #### SC_PARTIAL_CONTENT

          static final ResponsePredicate SC_PARTIAL_CONTENT

      Deprecated.
      206 Partial Content

    - #### SC_MULTI_STATUS

          static final ResponsePredicate SC_MULTI_STATUS

      Deprecated.
      207 Multi-Status (WebDAV, RFC2518)

    - #### SC_REDIRECTION

          static final ResponsePredicate SC_REDIRECTION

      Deprecated.
      Any 3XX redirection

    - #### SC_MULTIPLE_CHOICES

          static final ResponsePredicate SC_MULTIPLE_CHOICES

      Deprecated.
      300 Multiple Choices

    - #### SC_MOVED_PERMANENTLY

          static final ResponsePredicate SC_MOVED_PERMANENTLY

      Deprecated.
      301 Moved Permanently

    - #### SC_FOUND

          static final ResponsePredicate SC_FOUND

      Deprecated.
      302 Found

    - #### SC_SEE_OTHER

          static final ResponsePredicate SC_SEE_OTHER

      Deprecated.
      303 See Other (since HTTP/1.1)

    - #### SC_NOT_MODIFIED

          static final ResponsePredicate SC_NOT_MODIFIED

      Deprecated.
      304 Not Modified

    - #### SC_USE_PROXY

          static final ResponsePredicate SC_USE_PROXY

      Deprecated.
      305 Use Proxy (since HTTP/1.1)

    - #### SC_TEMPORARY_REDIRECT

          static final ResponsePredicate SC_TEMPORARY_REDIRECT

      Deprecated.
      307 Temporary Redirect (since HTTP/1.1)

    - #### SC_PERMANENT_REDIRECT

          static final ResponsePredicate SC_PERMANENT_REDIRECT

      Deprecated.
      308 Permanent Redirect (RFC7538)

    - #### SC_CLIENT_ERRORS

          static final ResponsePredicate SC_CLIENT_ERRORS

      Deprecated.
      Any 4XX client error

    - #### SC_BAD_REQUEST

          static final ResponsePredicate SC_BAD_REQUEST

      Deprecated.
      400 Bad Request

    - #### SC_UNAUTHORIZED

          static final ResponsePredicate SC_UNAUTHORIZED

      Deprecated.
      401 Unauthorized

    - #### SC_PAYMENT_REQUIRED

          static final ResponsePredicate SC_PAYMENT_REQUIRED

      Deprecated.
      402 Payment Required

    - #### SC_FORBIDDEN

          static final ResponsePredicate SC_FORBIDDEN

      Deprecated.
      403 Forbidden

    - #### SC_NOT_FOUND

          static final ResponsePredicate SC_NOT_FOUND

      Deprecated.
      404 Not Found

    - #### SC_METHOD_NOT_ALLOWED

          static final ResponsePredicate SC_METHOD_NOT_ALLOWED

      Deprecated.
      405 Method Not Allowed

    - #### SC_NOT_ACCEPTABLE

          static final ResponsePredicate SC_NOT_ACCEPTABLE

      Deprecated.
      406 Not Acceptable

    - #### SC_PROXY_AUTHENTICATION_REQUIRED

          static final ResponsePredicate SC_PROXY_AUTHENTICATION_REQUIRED

      Deprecated.
      407 Proxy Authentication Required

    - #### SC_REQUEST_TIMEOUT

          static final ResponsePredicate SC_REQUEST_TIMEOUT

      Deprecated.
      408 Request Timeout

    - #### SC_CONFLICT

          static final ResponsePredicate SC_CONFLICT

      Deprecated.
      409 Conflict

    - #### SC_GONE

          static final ResponsePredicate SC_GONE

      Deprecated.
      410 Gone

    - #### SC_LENGTH_REQUIRED

          static final ResponsePredicate SC_LENGTH_REQUIRED

      Deprecated.
      411 Length Required

    - #### SC_PRECONDITION_FAILED

          static final ResponsePredicate SC_PRECONDITION_FAILED

      Deprecated.
      412 Precondition Failed

    - #### SC_REQUEST_ENTITY_TOO_LARGE

          static final ResponsePredicate SC_REQUEST_ENTITY_TOO_LARGE

      Deprecated.
      413 Request Entity Too Large

    - #### SC_REQUEST_URI_TOO_LONG

          static final ResponsePredicate SC_REQUEST_URI_TOO_LONG

      Deprecated.
      414 Request-URI Too Long

    - #### SC_UNSUPPORTED_MEDIA_TYPE

          static final ResponsePredicate SC_UNSUPPORTED_MEDIA_TYPE

      Deprecated.
      415 Unsupported Media Type

    - #### SC_REQUESTED_RANGE_NOT_SATISFIABLE

          static final ResponsePredicate SC_REQUESTED_RANGE_NOT_SATISFIABLE

      Deprecated.
      416 Requested Range Not Satisfiable

    - #### SC_EXPECTATION_FAILED

          static final ResponsePredicate SC_EXPECTATION_FAILED

      Deprecated.
      417 Expectation Failed

    - #### SC_MISDIRECTED_REQUEST

          static final ResponsePredicate SC_MISDIRECTED_REQUEST

      Deprecated.
      421 Misdirected Request

    - #### SC_UNPROCESSABLE_ENTITY

          static final ResponsePredicate SC_UNPROCESSABLE_ENTITY

      Deprecated.
      422 Unprocessable Entity (WebDAV, RFC4918)

    - #### SC_LOCKED

          static final ResponsePredicate SC_LOCKED

      Deprecated.
      423 Locked (WebDAV, RFC4918)

    - #### SC_FAILED_DEPENDENCY

          static final ResponsePredicate SC_FAILED_DEPENDENCY

      Deprecated.
      424 Failed Dependency (WebDAV, RFC4918)

    - #### SC_UNORDERED_COLLECTION

          static final ResponsePredicate SC_UNORDERED_COLLECTION

      Deprecated.
      425 Unordered Collection (WebDAV, RFC3648)

    - #### SC_UPGRADE_REQUIRED

          static final ResponsePredicate SC_UPGRADE_REQUIRED

      Deprecated.
      426 Upgrade Required (RFC2817)

    - #### SC_PRECONDITION_REQUIRED

          static final ResponsePredicate SC_PRECONDITION_REQUIRED

      Deprecated.
      428 Precondition Required (RFC6585)

    - #### SC_TOO_MANY_REQUESTS

          static final ResponsePredicate SC_TOO_MANY_REQUESTS

      Deprecated.
      429 Too Many Requests (RFC6585)

    - #### SC_REQUEST_HEADER_FIELDS_TOO_LARGE

          static final ResponsePredicate SC_REQUEST_HEADER_FIELDS_TOO_LARGE

      Deprecated.
      431 Request Header Fields Too Large (RFC6585)

    - #### SC_SERVER_ERRORS

          static final ResponsePredicate SC_SERVER_ERRORS

      Deprecated.
      Any 5XX server error

    - #### SC_INTERNAL_SERVER_ERROR

          static final ResponsePredicate SC_INTERNAL_SERVER_ERROR

      Deprecated.
      500 Internal Server Error

    - #### SC_NOT_IMPLEMENTED

          static final ResponsePredicate SC_NOT_IMPLEMENTED

      Deprecated.
      501 Not Implemented

    - #### SC_BAD_GATEWAY

          static final ResponsePredicate SC_BAD_GATEWAY

      Deprecated.
      502 Bad Gateway

    - #### SC_SERVICE_UNAVAILABLE

          static final ResponsePredicate SC_SERVICE_UNAVAILABLE

      Deprecated.
      503 Service Unavailable

    - #### SC_GATEWAY_TIMEOUT

          static final ResponsePredicate SC_GATEWAY_TIMEOUT

      Deprecated.
      504 Gateway Timeout

    - #### SC_HTTP_VERSION_NOT_SUPPORTED

          static final ResponsePredicate SC_HTTP_VERSION_NOT_SUPPORTED

      Deprecated.
      505 HTTP Version Not Supported

    - #### SC_VARIANT_ALSO_NEGOTIATES

          static final ResponsePredicate SC_VARIANT_ALSO_NEGOTIATES

      Deprecated.
      506 Variant Also Negotiates (RFC2295)

    - #### SC_INSUFFICIENT_STORAGE

          static final ResponsePredicate SC_INSUFFICIENT_STORAGE

      Deprecated.
      507 Insufficient Storage (WebDAV, RFC4918)

    - #### SC_NOT_EXTENDED

          static final ResponsePredicate SC_NOT_EXTENDED

      Deprecated.
      510 Not Extended (RFC2774)

    - #### SC_NETWORK_AUTHENTICATION_REQUIRED

          static final ResponsePredicate SC_NETWORK_AUTHENTICATION_REQUIRED

      Deprecated.
      511 Network Authentication Required (RFC6585)

    - #### JSON

          static final ResponsePredicate JSON

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

  - ### Method Detail

    - #### status

          static ResponsePredicate status(int statusCode)

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

    - #### status

          static ResponsePredicate status(int min,
                                          int max)

      Deprecated.
      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

    - #### contentType

          static ResponsePredicate contentType(String mimeType)

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

    - #### contentType

          static ResponsePredicate contentType(List<String> mimeTypes)

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

    - #### create

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

      Deprecated.
      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

    - #### create

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

      Deprecated.
      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`

    - #### errorConverter

          default ErrorConverter errorConverter()

      Deprecated.
      Returns:
        the error converter currently used

Copyright © 2024 Eclipse. All rights reserved.