Class Response
- java.lang.Object
-
- com.mongodb.stitch.core.internal.net.Response
-
-
Constructor Summary
Constructors Constructor Description Response(byte[] body)
Constructs a successful (200 OK) response from raw body bytes.Response(int statusCode)
Constructs a response from the given status code.Response(int statusCode, byte[] body)
Constructs a response from a status code and raw body bytes.Response(int statusCode, InputStream body)
Constructs a response from a status code and body.Response(int statusCode, String body)
Constructs a response from a status and a body represented by aString
.Response(int statusCode, Map<String,String> headers)
Constructs a response from a status and headers.Response(int statusCode, Map<String,String> headers, InputStream body)
Constructs a response from a status code, headers, and bodu.Response(int statusCode, Map<String,String> headers, String body)
Constructs a response from a status, headers, and a body represented by aString
.Response(String body)
Constructs a successful (200 OK) response from a body represented by aString
.
-
Method Summary
Modifier and Type Method Description InputStream
getBody()
Returns the body of the response; may be null.Map<String,String>
getHeaders()
Returns the headers of the response.int
getStatusCode()
Returns the status code of the response.
-
-
-
Constructor Detail
-
Response
public Response(int statusCode, Map<String,String> headers, InputStream body)
Constructs a response from a status code, headers, and bodu.- Parameters:
statusCode
- the status code of the response.headers
- the headers of the response.body
- the body of the response.
-
Response
public Response(int statusCode, InputStream body)
Constructs a response from a status code and body.- Parameters:
statusCode
- the status code of the response.body
- the body of the response.
-
Response
public Response(int statusCode, byte[] body)
Constructs a response from a status code and raw body bytes.- Parameters:
statusCode
- the status code of the response.body
- the body of the response as raw bytes.
-
Response
public Response(int statusCode, Map<String,String> headers, String body)
Constructs a response from a status, headers, and a body represented by aString
.- Parameters:
statusCode
- the status code of the response.headers
- the headers of the response.body
- the body of the response as a string.
-
Response
public Response(int statusCode, String body)
Constructs a response from a status and a body represented by aString
.- Parameters:
statusCode
- the status code of the response.body
- the body of the response as a string.
-
Response
public Response(int statusCode, Map<String,String> headers)
Constructs a response from a status and headers.- Parameters:
statusCode
- the status code of the response.headers
- the headers of the response.
-
Response
public Response(byte[] body)
Constructs a successful (200 OK) response from raw body bytes.- Parameters:
body
- the body of the response as raw bytes.
-
Response
public Response(String body)
Constructs a successful (200 OK) response from a body represented by aString
.- Parameters:
body
- the body of the response as a string.
-
Response
public Response(int statusCode)
Constructs a response from the given status code.- Parameters:
statusCode
- the status code of the response.
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Returns the status code of the response.- Returns:
- the status code of the response.
-
getHeaders
public Map<String,String> getHeaders()
Returns the headers of the response.- Returns:
- the headers of the response.
-
getBody
@Nullable public InputStream getBody()
Returns the body of the response; may be null.- Returns:
- the body of the response; may be null.
-
-