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
- exceptionBoxJSONException
public int getExpectedResponseCode()
IBoxRequest
getExpectedResponseCode
in interface IBoxRequest
protected void setExpectedResponseCode(int code)
code
- codepublic org.apache.http.params.HttpParams getHttpParams()
IBoxRequest
getHttpParams
in interface IBoxRequest
public IBoxRequestAuth getAuth()
IBoxRequest
getAuth
in interface IBoxRequest
public ICookie getCookie()
IBoxRequest
getCookie
in interface IBoxRequest
public org.apache.http.HttpEntity getRequestEntity()
IBoxRequest
getRequestEntity
in interface IBoxRequest
public RestMethod getRestMethod()
IBoxRequest
getRestMethod
in interface IBoxRequest
public org.apache.http.client.methods.HttpRequestBase getRawRequest()
public void setAuth(IBoxRequestAuth auth)
IBoxRequest
setAuth
in interface IBoxRequest
auth
- authpublic void setCookie(ICookie cookie)
IBoxRequest
setCookie
in interface IBoxRequest
cookie
- cookie.public void setEntity(org.apache.http.HttpEntity entity)
entity
- entity.public void addQueryParam(java.lang.String name, java.lang.String value)
IBoxRequest
addQueryParam
in interface IBoxRequest
name
- name of the parametervalue
- value of the parameterpublic void addHeader(java.lang.String name, java.lang.String value)
IBoxRequest
addHeader
in interface IBoxRequest
name
- 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
IBoxRequest
prepareRequest
in interface IBoxRequest
BoxRestException
AuthFatalFailureException
public IBoxConfig getConfig()
public java.lang.String getScheme()
IBoxRequest
getScheme
in interface IBoxRequest
public java.lang.String getAuthority()
IBoxRequest
getAuthority
in interface IBoxRequest
public java.lang.String getApiUrlPath()
IBoxRequest
getApiUrlPath
in interface IBoxRequest