Class HttpResponse
- java.lang.Object
-
- com.mongodb.stitch.core.services.http.HttpResponse
-
public class HttpResponse extends Object
The response to an HTTP request over the HTTP service.
-
-
Constructor Summary
Constructors Constructor Description HttpResponse(String status, int statusCode, long contentLength, Map<String,Collection<String>> headers, Map<String,HttpCookie> cookies, byte[] body)Constructs a new response to an HTTP request.
-
Method Summary
Modifier and Type Method Description byte[]getBody()Returns a copy of the response body.longgetContentLength()Returns the content length of the response.Map<String,HttpCookie>getCookies()Returns the response cookies.Map<String,Collection<String>>getHeaders()Returns the response headers.StringgetStatus()Returns the human readable status of the response.intgetStatusCode()Returns the status code of the response.
-
-
-
Constructor Detail
-
HttpResponse
public HttpResponse(String status, int statusCode, long contentLength, Map<String,Collection<String>> headers, Map<String,HttpCookie> cookies, byte[] body)
Constructs a new response to an HTTP request.- Parameters:
status- the human readable status of the response.statusCode- the status code of the response.contentLength- the content length of the response.headers- the response headers.cookies- the response cookies.body- the response body.
-
-
Method Detail
-
getStatus
@Nonnull public String getStatus()
Returns the human readable status of the response.- Returns:
- the human readable status of the response.
-
getStatusCode
public int getStatusCode()
Returns the status code of the response.- Returns:
- the status code of the response.
-
getContentLength
public long getContentLength()
Returns the content length of the response.- Returns:
- the content length of the response.
-
getHeaders
@Nullable public Map<String,Collection<String>> getHeaders()
Returns the response headers.- Returns:
- the response headers.
-
getCookies
@Nullable public Map<String,HttpCookie> getCookies()
Returns the response cookies.- Returns:
- the response cookies.
-
getBody
@Nullable public byte[] getBody()
Returns a copy of the response body.- Returns:
- a copy of the response body.
-
-