Class HttpResponseImpl
- java.lang.Object
-
- org.openstack4j.connectors.httpclient.HttpResponseImpl
-
- All Implemented Interfaces:
Closeable,AutoCloseable,HttpResponse
public class HttpResponseImpl extends Object implements HttpResponse
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetContentType()<T> TgetEntity(Class<T> returnType)Gets the entity and Maps any errors which will result in a ResponseException<T> TgetEntity(Class<T> returnType, ExecutionOptions<T> options)Gets the entity and Maps any errors which will result in a ResponseExceptionInputStreamgetInputStream()intgetStatus()Gets the status from the previous RequestStringgetStatusMessage()Stringheader(String name)Returns a Header value from the specified name keyMap<String,String>headers()<T> TreadEntity(Class<T> typeToReadAs)org.apache.http.client.methods.CloseableHttpResponseunwrap()Unwrap and return the original Responsestatic HttpResponseImplwrap(org.apache.http.client.methods.CloseableHttpResponse response)Wrap the given Response
-
-
-
Method Detail
-
wrap
public static HttpResponseImpl wrap(org.apache.http.client.methods.CloseableHttpResponse response)
Wrap the given Response- Parameters:
response- the response- Returns:
- the HttpResponse
-
unwrap
public org.apache.http.client.methods.CloseableHttpResponse unwrap()
Unwrap and return the original Response- Returns:
- the response
-
getEntity
public <T> T getEntity(Class<T> returnType)
Gets the entity and Maps any errors which will result in a ResponseException- Specified by:
getEntityin interfaceHttpResponse- Type Parameters:
T- the generic type- Parameters:
returnType- the return type- Returns:
- the entity
-
getEntity
public <T> T getEntity(Class<T> returnType, ExecutionOptions<T> options)
Gets the entity and Maps any errors which will result in a ResponseException- Specified by:
getEntityin interfaceHttpResponse- Type Parameters:
T- the generic type- Parameters:
returnType- the return typeoptions- execution options- Returns:
- the entity
-
getStatus
public int getStatus()
Gets the status from the previous Request- Specified by:
getStatusin interfaceHttpResponse- Returns:
- the status code
-
getStatusMessage
public String getStatusMessage()
- Specified by:
getStatusMessagein interfaceHttpResponse
-
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStreamin interfaceHttpResponse- Returns:
- the input stream
-
header
public String header(String name)
Returns a Header value from the specified name key- Specified by:
headerin interfaceHttpResponse- Parameters:
name- the name of the header to query for- Returns:
- the header as a String or null if not found
-
headers
public Map<String,String> headers()
- Specified by:
headersin interfaceHttpResponse- Returns:
- the a Map of Header Name to Header Value
-
readEntity
public <T> T readEntity(Class<T> typeToReadAs)
- Specified by:
readEntityin interfaceHttpResponse
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceHttpResponse
-
-