Class HttpResponse<T>

java.lang.Object
io.vertx.mutiny.ext.web.client.HttpResponse<T>
All Implemented Interfaces:
MutinyDelegate, HttpResponseHead

public class HttpResponse<T> extends Object implements HttpResponseHead, MutinyDelegate
An HTTP response.

The usual HTTP response attributes are available:

The body of the response is returned by body() decoded as the format specified by the BodyCodec that built the response.

Keep in mind that using this HttpResponse impose to fully buffer the response body and should be used for payload that can fit in memory.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Julien Viet
See Also:
  • HttpResponse
  • Field Details

  • Constructor Details

    • HttpResponse

      public HttpResponse(io.vertx.ext.web.client.HttpResponse<T> delegate)
      Create a new instance of HttpResponse delegating to the given (non-null) instance of HttpResponse.
    • HttpResponse

      public HttpResponse(io.vertx.ext.web.client.HttpResponse<T> delegate, TypeArg<T> typeArg_0)
    • HttpResponse

      public HttpResponse(Object delegate, TypeArg<T> typeArg_0)
  • Method Details

    • getDelegate

      public io.vertx.ext.web.client.HttpResponse<T> getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface HttpResponseHead
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • trailers

      public io.vertx.core.MultiMap trailers()
      Returns:
      the trailers
    • getTrailer

      public String getTrailer(String trailerName)
      Return the first trailer value with the specified name
      Parameters:
      trailerName - the trailer name
      Returns:
      the trailer value. Can be null.
    • body

      public T body()
      Returns:
      the response body in the format it was decoded. Can be null.
    • bodyAsBuffer

      public io.vertx.core.buffer.Buffer bodyAsBuffer()
      Returns:
      the response body decoded as a Buffer, or null if a codec other than BodyCodec#buffer() was used
    • followedRedirects

      public List<String> followedRedirects()
      Returns:
      the list of all followed redirects, including the final location.
    • bodyAsString

      public String bodyAsString()
      Returns:
      the response body decoded as a String, or null if a codec other than BodyCodec#buffer() was used
    • bodyAsString

      public String bodyAsString(String encoding)
      Returns:
      the response body decoded as a String given a specific encoding, or null if a codec other than BodyCodec#buffer() was used
    • bodyAsJsonObject

      public io.vertx.core.json.JsonObject bodyAsJsonObject()
      Returns:
      the response body decoded as JsonObject, or null if a codec other than BodyCodec#buffer() was used
    • bodyAsJsonArray

      public io.vertx.core.json.JsonArray bodyAsJsonArray()
      Returns:
      the response body decoded as a JsonArray, or null if a codec other than BodyCodec#buffer() was used
    • bodyAsJson

      public <R> R bodyAsJson(Class<R> type)
      Returns:
      the response body decoded as the specified type with the Jackson mapper, or null if a codec other than BodyCodec#buffer() was used
    • headers

      public io.vertx.core.MultiMap headers()
      Specified by:
      headers in interface HttpResponseHead
      Returns:
      the headers
    • statusCode

      public int statusCode()
      Specified by:
      statusCode in interface HttpResponseHead
      Returns:
      the status code of the response
    • getHeader

      public String getHeader(String headerName)
      Return the first header value with the specified name
      Specified by:
      getHeader in interface HttpResponseHead
      Parameters:
      headerName - the header name
      Returns:
      the header value. Can be null.
    • statusMessage

      public String statusMessage()
      Specified by:
      statusMessage in interface HttpResponseHead
      Returns:
      the status message of the response
    • version

      public io.vertx.core.http.HttpVersion version()
      Specified by:
      version in interface HttpResponseHead
      Returns:
      the version of the response
    • getHeader

      public String getHeader(CharSequence headerName)
      Return the first header value with the specified name
      Specified by:
      getHeader in interface HttpResponseHead
      Parameters:
      headerName - the header name
      Returns:
      the header value
    • cookies

      public List<String> cookies()
      Specified by:
      cookies in interface HttpResponseHead
      Returns:
      the Set-Cookie headers (including trailers)
    • newInstance

      public static <T> HttpResponse<T> newInstance(io.vertx.ext.web.client.HttpResponse<T> delegate)
      Creates a new instance of the HttpResponse.
    • newInstance

      public static <T> HttpResponse<T> newInstance(io.vertx.ext.web.client.HttpResponse<T> delegate, TypeArg<T> typeArg_0)
      Creates a new instance of the HttpResponse.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object