public class DefaultBoxRequest extends java.lang.Object implements IBoxRequest
| Constructor and Description |
|---|
DefaultBoxRequest(IBoxConfig config,
IBoxJSONParser parser,
java.lang.String uriPath,
RestMethod restMethod,
BoxDefaultRequestObject requestObject)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value)
Add header into request.
|
void |
addHttpParam(java.lang.String name,
java.lang.String value)
Add http param.
|
void |
addQueryParam(java.lang.String name,
java.lang.String value)
Add query parameters into request url.
|
java.lang.String |
getApiUrlPath()
Get api path for the api call.
|
IBoxRequestAuth |
getAuth()
Auth.
|
java.lang.String |
getAuthority()
Get authority for the api call.
|
IBoxConfig |
getConfig() |
ICookie |
getCookie()
Cookie.
|
int |
getExpectedResponseCode()
Get expected response code.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Get the headers.
|
org.apache.http.params.HttpParams |
getHttpParams()
HttpParams
|
java.util.Map<java.lang.String,java.lang.String> |
getQueryParams()
Get query parameters.
|
org.apache.http.client.methods.HttpRequestBase |
getRawRequest()
Get raw request underlying this DefaultBoxRequest.
|
org.apache.http.HttpEntity |
getRequestEntity()
Request entity.
|
RestMethod |
getRestMethod()
REST method, GET/PUT/POST/DELETE/...
|
java.lang.String |
getScheme()
Get scheme for the api call.
|
org.apache.http.client.methods.HttpRequestBase |
prepareRequest()
Prepare the request by setting all headers, query params, entities...
|
void |
setAuth(IBoxRequestAuth auth)
Set authorization.
|
void |
setCookie(ICookie cookie)
Set cookie.
|
void |
setEntity(org.apache.http.HttpEntity entity)
Set entity for the request.
|
protected void |
setExpectedResponseCode(int code)
Set the expected returned http response status code.
|
void |
setIfMatch(java.lang.String ifMatch)
Set If-Match header.
|
void |
setRequestFields(java.util.List<java.lang.String> fields)
Set fields on the request.
|
public DefaultBoxRequest(IBoxConfig config, IBoxJSONParser parser, java.lang.String uriPath, RestMethod restMethod, BoxDefaultRequestObject requestObject) throws BoxRestException
config - configparser - json parseruriPath - e.g. /folders/93285/itemsrestMethod - REST methodrequestObject - request objectBoxRestException - exceptionBoxJSONExceptionpublic int getExpectedResponseCode()
IBoxRequestgetExpectedResponseCode in interface IBoxRequestprotected void setExpectedResponseCode(int code)
code - codepublic org.apache.http.params.HttpParams getHttpParams()
IBoxRequestgetHttpParams in interface IBoxRequestpublic IBoxRequestAuth getAuth()
IBoxRequestgetAuth in interface IBoxRequestpublic ICookie getCookie()
IBoxRequestgetCookie in interface IBoxRequestpublic org.apache.http.HttpEntity getRequestEntity()
IBoxRequestgetRequestEntity in interface IBoxRequestpublic RestMethod getRestMethod()
IBoxRequestgetRestMethod in interface IBoxRequestpublic org.apache.http.client.methods.HttpRequestBase getRawRequest()
public void setAuth(IBoxRequestAuth auth)
IBoxRequestsetAuth in interface IBoxRequestauth - authpublic void setCookie(ICookie cookie)
IBoxRequestsetCookie in interface IBoxRequestcookie - cookie.public void setEntity(org.apache.http.HttpEntity entity)
entity - entity.public void addQueryParam(java.lang.String name,
java.lang.String value)
IBoxRequestaddQueryParam in interface IBoxRequestname - name of the parametervalue - value of the parameterpublic void addHeader(java.lang.String name,
java.lang.String value)
IBoxRequestaddHeader in interface IBoxRequestname - name of headervalue - value of headerpublic void setIfMatch(java.lang.String ifMatch)
ifMatch - the If-Match header valuepublic void setRequestFields(java.util.List<java.lang.String> fields)
fields - fieldspublic java.util.Map<java.lang.String,java.lang.String> getHeaders()
public void addHttpParam(java.lang.String name,
java.lang.String value)
name - namevalue - valuepublic java.util.Map<java.lang.String,java.lang.String> getQueryParams()
public org.apache.http.client.methods.HttpRequestBase prepareRequest()
throws BoxRestException,
AuthFatalFailureException
IBoxRequestprepareRequest in interface IBoxRequestBoxRestExceptionAuthFatalFailureExceptionpublic IBoxConfig getConfig()
public java.lang.String getScheme()
IBoxRequestgetScheme in interface IBoxRequestpublic java.lang.String getAuthority()
IBoxRequestgetAuthority in interface IBoxRequestpublic java.lang.String getApiUrlPath()
IBoxRequestgetApiUrlPath in interface IBoxRequest