public class BoxJSONResponse extends BoxAPIResponse
This request type extends BoxAPIResponse to provide additional functionality for handling JSON strings. It reads the response body into a string and allows the JSON in the response to be logged.
Constructor and Description |
---|
BoxJSONResponse()
Constructs a BoxJSONResponse without an associated HttpURLConnection.
|
BoxJSONResponse(int responseCode,
String requestMethod,
String requestUrl,
Map<String,List<String>> headers,
JsonObject body)
Constructs a BoxAPIResponse with an http response code and response body.
|
Modifier and Type | Method and Description |
---|---|
protected String |
bodyToString()
Returns a string representation of this response's body.
|
String |
getJSON()
Gets the body of the response as a JSON string.
|
JsonObject |
getJsonObject()
Get response as Json Object.
|
close, disconnect, getBody, getBody, getContentLength, getHeaderField, getHeaders, getRequestMethod, getRequestUrl, getResponseCode, toString
public BoxJSONResponse()
public BoxJSONResponse(int responseCode, String requestMethod, String requestUrl, Map<String,List<String>> headers, JsonObject body)
responseCode
- http response codeheaders
- map of http headersbody
- response body as Json Objectpublic JsonObject getJsonObject()
public String getJSON()
BoxAPIResponse.getBody()
can no longer be used.protected String bodyToString()
BoxAPIResponse
bodyToString
in class BoxAPIResponse