Package com.sodius.oslc.client
Interface ClientResponse
-
public interface ClientResponse
An HTTP response that was received after executing any one of the invocation methods on aOslcResource
.- Since:
- 3.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
consumeContent()
Consumes entity content.<T> Collection<T>
getEntities(Class<T> entityType)
Get a collection of entities from the response.<T> T
getEntity(Class<T> cls)
Get the response entity.MultivaluedMap<String,String>
getHeaders()
Get the map of headersString
getMessage()
Get the response message.int
getStatusCode()
Get the response status code.Response.StatusType
getStatusType()
Gets the response status as a status type.void
setEntity(Object entity)
Set the response entityvoid
setMessage(String message)
Set the response messagevoid
setStatusCode(int statusCode)
Set the response status code
-
-
-
Method Detail
-
getStatusType
Response.StatusType getStatusType()
Gets the response status as a status type.- Returns:
- the response status
-
getStatusCode
int getStatusCode()
Get the response status code.- Returns:
- response status code
-
getMessage
String getMessage()
Get the response message.- Returns:
- response message
-
getHeaders
MultivaluedMap<String,String> getHeaders()
Get the map of headers- Returns:
- the map of headers
-
getEntity
<T> T getEntity(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. 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
- Throws:
ClientRuntimeException
- if there are exceptions that the client encounters
-
getEntities
<T> Collection<T> getEntities(Class<T> entityType)
Get a collection of entities from the response. As suggested by theCollection
return type, the order of entities is not preserved.The entities are read using the appropriate provider before returning it. Subsequent calls to getEntities will return the same instance of the entity.
- Type Parameters:
T
- type of the response entity to get- Parameters:
entityType
- the type of entities to get- Returns:
- the collection of entities read from the response
- Throws:
ClientRuntimeException
- if there are exceptions that the client encounters
-
setEntity
void setEntity(Object entity)
Set the response entity- Parameters:
entity
- response entity to set
-
setStatusCode
void setStatusCode(int statusCode)
Set the response status code- Parameters:
statusCode
- response status code to set
-
setMessage
void setMessage(String message)
Set the response message- Parameters:
message
- response message to set
-
consumeContent
void consumeContent()
Consumes entity content. It's needed to call this method, if the calling code decides not to handle content.
-
-