Package ca.uhn.fhir.rest.client.api
Interface IHttpResponse
-
public interface IHttpResponse
An interface around the HTTP Response.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbufferEntity()Buffer the message entity data.voidclose()Close the responseReadercreateReader()Returns a reader for the response entityMap<String,List<String>>getAllHeaders()Get map of the response headers and corresponding string values.List<String>getHeaders(String theName)Return all headers in the response with the given typeStringgetMimeType()ExtractsContent-Typevalue from the response exactly as specified by theContent-Typeheader.StopWatchgetRequestStopWatch()ObjectgetResponse()intgetStatus()Get the status code associated with the response.StringgetStatusInfo()Get the response status information reason phrase associated with the response.InputStreamreadEntity()Read the message entity input stream as an InputStream.
-
-
-
Method Detail
-
bufferEntity
void bufferEntity() throws IOException
Buffer the message entity data.In case the message entity is backed by an unconsumed entity input stream, all the bytes of the original entity input stream are read and stored in a local buffer. The original entity input stream is consumed.
In case the response entity instance is not backed by an unconsumed input stream an invocation of
bufferEntitymethod is ignored and the method returns.This operation is idempotent, i.e. it can be invoked multiple times with the same effect which also means that calling the
bufferEntity()method on an already buffered (and thus closed) message instance is legal and has no further effect.Buffering the message entity data allows for multiple invocations of
readEntity(...)methods on the response instance.- Throws:
IOException- Since:
- 2.2
-
close
void close()
Close the response
-
createReader
Reader createReader() throws IOException
Returns a reader for the response entity- Throws:
IOException
-
getAllHeaders
Map<String,List<String>> getAllHeaders()
Get map of the response headers and corresponding string values.- Returns:
- response headers as a map header keys and they values.
-
getHeaders
List<String> getHeaders(String theName)
Return all headers in the response with the given type
-
getMimeType
String getMimeType()
ExtractsContent-Typevalue from the response exactly as specified by theContent-Typeheader. Returnsnullif not specified.
-
getRequestStopWatch
StopWatch getRequestStopWatch()
- Returns:
- Returns a StopWatch that was started right before the client request was started. The time returned by this client includes any time that was spent within the HTTP library (possibly including waiting for a connection, and any network activity)
-
getResponse
Object getResponse()
- Returns:
- the native response, depending on the client library used
-
getStatus
int getStatus()
Get the status code associated with the response.- Returns:
- the response status code.
-
getStatusInfo
String getStatusInfo()
Get the response status information reason phrase associated with the response.- Returns:
- the reason phrase.
-
readEntity
InputStream readEntity() throws IOException
Read the message entity input stream as an InputStream.- Throws:
IOException
-
-