com.sun.jersey.api.client

Class ClientResponse

  • java.lang.Object
    • com.sun.jersey.api.client.ClientResponse


  • public class ClientResponseextends java.lang.Object
    A client (in-bound) HTTP response.
    Author:
    Paul.Sandoz@Sun.Com
    • Constructor Detail

      • ClientResponse

        public ClientResponse(Response.StatusType statusType,              InBoundHeaders headers,              java.io.InputStream entity,              MessageBodyWorkers workers)
        Create a new instance initialized form statusType, headers, entity, workers.
        Parameters:
        statusType - Status type.
        headers - HTTP headers.
        entity - Entity input stream.
        workers - Message body workers.
      • ClientResponse

        public ClientResponse(int statusCode,              InBoundHeaders headers,              java.io.InputStream entity,              MessageBodyWorkers workers)
        Create a new instance initialized form statusCode, headers, entity, workers.
        Parameters:
        headers - HTTP headers.
        entity - Entity input stream.
        workers - Message body workers.
    • Method Detail

      • getClient

        public Client getClient()
        Get the client.
        Returns:
        the client.
      • getProperties

        public java.util.Map<java.lang.String,java.lang.Object> getProperties()
        Get the map of response properties.

        A response property is an application-defined property that may be added by the user, a filter, or the handler that is managing the connection.

        Returns:
        the map of response properties.
      • getStatus

        public int getStatus()
        Get the status code.
        Returns:
        the status code.
      • setStatus

        public void setStatus(int status)
        Set the status code.
        Parameters:
        status - the status code.
      • getClientResponseStatus

        @Deprecatedpublic ClientResponse.Status getClientResponseStatus()
        Deprecated. Deprecated since 1.18. Use getStatusInfo() which can return status type even for status codes which do not have mapping defined in Response.Status.
        Get the status code.
        Returns:
        the status code, or null if the underlying status code was set using the method setStatus(int) and there is no mapping between the integer value and the Response.Status enumeration value.
      • getStatusInfo

        public Response.StatusType getStatusInfo()
        Get the status type. Status type can be describe a standard response status defined by the HTTP specification and defined in Response.Status enumeration but also can contain status codes which are not defined by Response.Status enumeration (for example custom status code returned from a resource method).
        Returns:
        Non-null value of the status type.
      • getResponseStatus

        @Deprecatedpublic Response.Status getResponseStatus()
        Deprecated. use getClientResponseStatus()
        Get the status code.
        Returns:
        the status code, or null if the underlying status code was set using the method setStatus(int) and there is no mapping between the integer value and the Response.Status enumeration value.
      • getMetadata

        @Deprecatedpublic MultivaluedMap<java.lang.String,java.lang.String> getMetadata()
        Deprecated. 
        Get the HTTP headers of the response.
        Returns:
        the HTTP headers of the response.
      • getHeaders

        public MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
        Get the HTTP headers of the response.
        Returns:
        the HTTP headers of the response.
      • hasEntity

        public boolean hasEntity()
        Checks if there is an entity available.
        Returns:
        true if there is an entity present in the response.
      • getEntityInputStream

        public java.io.InputStream getEntityInputStream()
        Get the input stream of the response.
        Returns:
        the input stream of the response.
      • setEntityInputStream

        public void setEntityInputStream(java.io.InputStream entity)
        Set the input stream of the response.
        Parameters:
        entity - the input stream of the response.
      • getEntity

        public <T> T getEntity(java.lang.Class<T> c)            throws ClientHandlerException,                   UniformInterfaceException
        Get the entity of the response.

        If the entity is not an instance of Closeable then the entity input stream is closed.

        Type Parameters:
        T - the type of the response.
        Parameters:
        c - the type of the entity.
        Returns:
        an instance of the type c.
        Throws:
        ClientHandlerException - if there is an error processing the response.
        UniformInterfaceException - if the response status is 204 (No Content).
      • bufferEntity

        public void bufferEntity()                  throws ClientHandlerException
        Buffer the entity.

        All the bytes of the original entity input stream will be read and stored in memory. The original entity input stream will then be closed.

        Throws:
        ClientHandlerException - if there is an error processing the response.
      • getType

        public MediaType getType()
        Get the media type of the response.
        Returns:
        the media type.
      • getLocation

        public java.net.URI getLocation()
        Get the location.
        Returns:
        the location, otherwise null if not present.
      • getEntityTag

        public EntityTag getEntityTag()
        Get the entity tag.
        Returns:
        the entity tag, otherwise null if not present.
      • getLastModified

        public java.util.Date getLastModified()
        Get the last modified date.
        Returns:
        the last modified date, otherwise null if not present.
      • getResponseDate

        public java.util.Date getResponseDate()
        Get response date (server side).
        Returns:
        the server side response date, otherwise null if not present.
      • getLanguage

        public java.lang.String getLanguage()
        Get the language.
        Returns:
        the language, otherwise null if not present.
      • getLength

        public int getLength()
        Get Content-Length.
        Returns:
        Content-Length as integer if present and valid number. In other cases returns -1.
      • getCookies

        public java.util.List<NewCookie> getCookies()
        Get the list of cookies.
        Returns:
        the cookies.
      • getAllow

        public java.util.Set<java.lang.String> getAllow()
        Get the allowed HTTP methods from the Allow HTTP header.

        Note that the Allow HTTP header will be returned from an OPTIONS request.

        Returns:
        the allowed HTTP methods, all methods will returned as upper case strings.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

Copyright © 2014 Oracle Corporation. All Rights Reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14