org.apache.wink.client
Interface ClientResponse

All Superinterfaces:
org.apache.wink.client.internal.BaseRequestResponse

public interface ClientResponse
extends org.apache.wink.client.internal.BaseRequestResponse

Represents an http response that was received after invoking any one of the invocation methods on a Resource. An instance of a ClientResponse is created by the ConnectionHandler at the end of the handler chain, and is returned from every handler on the chain.


Method Summary
<T> T
getEntity(java.lang.Class<T> cls)
          Get the response entity.
<T> T
getEntity(EntityType<T> entityType)
          Get the response entity.
 java.lang.String getMessage()
          Get the response message
 int getStatusCode()
          Get the response status code
 void setEntity(java.lang.Object entity)
          Set the response entity
 void setMessage(java.lang.String message)
          Set the response message
 void setStatusCode(int code)
          Set the response status code
 
Methods inherited from interface org.apache.wink.client.internal.BaseRequestResponse
getAttribute, getAttributes, getHeaders, setAttribute
 

Method Detail

getStatusCode

int getStatusCode()
Get the response status code

Returns:
response status code

setStatusCode

void setStatusCode(int code)
Set the response status code

Parameters:
code - status code to set

getMessage

java.lang.String getMessage()
Get the response message

Returns:
response message

setMessage

void setMessage(java.lang.String message)
Set the response message

Parameters:
message - response message to set

getEntity

<T> T getEntity(java.lang.Class<T> cls)
Get the response entity.

If the requested type to return is InputStream, then the input stream of the response is returned, and the entity is not read using the providers. The returned input stream is the adapted input stream as created by the InputStream adapters. If the InputStream is read directly, then it will not be possible to receive the entity as any other type other than InputStream.

If the requested type to return is anything other than InputStream, then the entity is read using the appropriate provider before returning it. Subsequent calls to getEntity will return the same instance of the entity.

Type Parameters:
T - type of the response entity to get
Parameters:
cls - class of the response entity to get
Returns:
the response entity

getEntity

<T> T getEntity(EntityType<T> entityType)
Get the response entity.

If the requested type to return is InputStream, then the input stream of the response is returned, and the entity is not read using the providers. The returned input stream is the adapted input stream as created by the InputStream adapters. If the InputStream is read directly, then it will not be possible to receive the entity as any other type other than InputStream.

If the requested type to return is anything other than InputStream, then the entity is read using the appropriate provider before returning it. Subsequent calls to getEntity will return the same instance of the entity.

Type Parameters:
T - type of the response entity to get
Parameters:
entityType - an instance of EntityType specifying the type of the entity
Returns:

setEntity

void setEntity(java.lang.Object entity)
Set the response entity

Parameters:
entity - response entity to set


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.