public class BoxJSONRequest extends BoxAPIRequest
This request type extends BoxAPIRequest to provide additional functionality for handling JSON strings. It automatically sets the appropriate "Content-Type" HTTP headers and allows the JSON in the request to be logged.
| Constructor and Description |
|---|
BoxJSONRequest(BoxAPIConnection api,
URL url,
String method)
Constructs an authenticated BoxJSONRequest using a provided BoxAPIConnection.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
bodyToString()
Returns a String representation of this request's body used in
BoxAPIRequest.toString(). |
void |
setBody(String body)
Sets the body of this request to a given JSON string.
|
public BoxJSONRequest(BoxAPIConnection api, URL url, String method)
api - an API connection for authenticating the request.url - the URL of the request.method - the HTTP method of the request.public void setBody(String body)
setBody in class BoxAPIRequestbody - the JSON string to use as the body.protected String bodyToString()
BoxAPIRequestBoxAPIRequest.toString(). This method returns
null by default.
A subclass may want override this method if the body can be converted to a String for logging or debugging purposes.
bodyToString in class BoxAPIRequest