Interface HttpResponse

  • All Superinterfaces:
    AutoCloseable, Closeable

    public interface HttpResponse
    extends Closeable
    Wraps a Response from the Jersey Client
    Author:
    Jeremy Unruh
    • Method Detail

      • getEntity

        <T> T getEntity​(Class<T> returnType)
        Gets the entity and Maps any errors which will result in a ResponseException
        Type Parameters:
        T - the generic type
        Parameters:
        returnType - the return type
        Returns:
        the entity
      • getEntity

        <T> T getEntity​(Class<T> returnType,
                        ExecutionOptions<T> options)
        Gets the entity and Maps any errors which will result in a ResponseException
        Type Parameters:
        T - the generic type
        Parameters:
        returnType - the return type
        options - execution options
        Returns:
        the entity
      • readEntity

        <T> T readEntity​(Class<T> typeToReadAs)
        Reads the entity as is into the specified type without any exception mapping
        Parameters:
        typeToReadAs - the type to read the desired entity in as
        Returns:
        the entity
      • getStatus

        int getStatus()
        Gets the status from the previous Request
        Returns:
        the status code
      • getContentType

        String getContentType()
        The current content-type within the response
        Returns:
        the response content-type
      • getStatusMessage

        String getStatusMessage()
        The status message which is associated with the current getStatus()
        Returns:
        the status message or null
      • getInputStream

        InputStream getInputStream()
        Returns:
        the input stream
      • header

        String header​(String name)
        Returns a Header value from the specified name key
        Parameters:
        name - the name of the header to query for
        Returns:
        the header as a String or null if not found
      • headers

        Map<String,​String> headers()
        Returns:
        the a Map of Header Name to Header Value