public class FlexRESTClient
extends java.lang.Object
Constructor and Description |
---|
FlexRESTClient() |
FlexRESTClient(java.lang.String pURL) |
FlexRESTClient(java.lang.String pURL,
java.lang.String pPath) |
Modifier and Type | Method and Description |
---|---|
FlexRESTClient |
accept(MediaType pMediaType)
Sets media type that will be used for builder.
|
FlexRESTClient |
accept(java.lang.String pMediaType)
Sets media type that will be used for builder.
|
FlexRESTClient |
addHeader(java.lang.String pKey,
java.lang.Object pValue)
Adds one header to mHeaders that will be used for builder.
|
FlexRESTClient |
addOverrideCode(int pOverrideCode)
Adds an override code to mOverrideCodes that are used for the builder.
|
FlexRESTClient |
addOverrideCodes(java.util.Set<java.lang.Integer> pOverrideCodes)
Adds all override codes to mOverrideCodes that are used for the builder.
|
FlexRESTClient |
addQueryParameter(java.lang.String pKey,
java.lang.Object pValue)
Adds one query parameter to mQueryParameters.
|
FlexRESTClient |
basicauth(java.lang.String user,
java.lang.String password)
Creates a universal-mode Jersey 2.x HttpAuthenticationFeature for use in the getWebTarget method.
|
FlexRESTClient |
basicauth(java.lang.String user,
java.lang.String password,
boolean isPreEmptive)
Creates a PreEmptive Basic OR universal-mode Jersey 2.x HttpAuthenticationFeature for use in the getWebTarget method.
|
FlexRESTClient |
bearerToken(java.lang.String pToken)
Sets Authorization using Bearer token.
|
FlexRESTClient |
clearOverrideCodes()
Removes all override codes to mOverride codes that are used for the builder.
|
FlexRESTClient |
cookie(java.lang.String name,
java.lang.String value) |
static Entity |
createFormData(FormDataBodyPart bodyPart)
Creates a form data entity and adds the FormDataBodyPart.
|
static Entity |
createFormData(java.util.List<FormDataBodyPart> formData)
Creates form data entity based on given list of FormDataBodyPart.
|
static Entity |
createFormData(java.util.Map<java.lang.String,java.lang.Object> form) |
static Entity |
createFormDataWithInputStream(java.util.Map<java.lang.String,java.lang.Object> form,
java.lang.String inputStreamFileName) |
FlexRESTClientResponse |
delete() |
FlexRESTClientResponse |
get() |
FlexRESTClientResponse |
head() |
FlexRESTClient |
headers(java.util.Map<java.lang.String,java.lang.Object> pHeaders)
Sets headers that will be used for builder.
|
FlexRESTClient |
hostnameVerifier(javax.net.ssl.HostnameVerifier verifier) |
FlexRESTClient |
mediatype(MediaType pMediaType)
Sets media type that will be used for builder.
|
FlexRESTClient |
mediatype(java.lang.String pMediaType)
Sets media type that will be used for builder.
|
FlexRESTClient |
oauth(java.lang.String pToken)
Sets mAuth using the OAuth token provided that will be used for builder.
|
FlexRESTClientResponse |
options() |
FlexRESTClientResponse |
patch(Entity pBody) |
FlexRESTClientResponse |
patch(java.lang.String pBody) |
FlexRESTClient |
path(java.lang.String pPath)
Appends a path to the url
|
FlexRESTClientResponse |
post(Entity pBody) |
FlexRESTClientResponse |
post(java.lang.String pBody) |
FlexRESTClientResponse |
put(Entity pBody) |
FlexRESTClientResponse |
put(java.lang.String pBody) |
FlexRESTClient |
queryparameters(java.util.Map<java.lang.String,java.lang.Object> pQueryParams)
Sets mQueryParameters that are used for builder.
|
FlexRESTClient |
queryparameters(java.lang.String pQueryParams) |
FlexRESTClient |
setConnectTimeout(int pConnectTimeout)
Sets connect timeout on client.
|
FlexRESTClient |
setIgnoreSSLErrors(boolean pIgnoreSSLErrors)
Sets mIgnoreSSLErrors that is used for builder.
|
FlexRESTClient |
setReadTimeout(int pReadTimeout)
Sets read timeout on client.
|
FlexRESTClient |
setRegisterGZip(boolean pRegisterGZip)
Sets mRegisterGZip that is used for builder.
|
FlexRESTClient |
setValidateResponse(boolean pValidateResponse) |
FlexRESTClient |
sslContext(javax.net.ssl.SSLContext sslContext) |
FlexRESTClientResponse |
trace() |
FlexRESTClient |
url(java.lang.String pUrl)
Sets URL that is used for the builder.
|
protected void |
validateResponse(FlexRESTClientResponse pResponse)
Validates FlexRestResponse by checking response codes below 400 and throwing an error if the code number is overriden, then checking above 400 codes and throwing and error if the code number is not overriden.
|
public FlexRESTClient()
public FlexRESTClient(java.lang.String pURL)
public FlexRESTClient(java.lang.String pURL, java.lang.String pPath)
public FlexRESTClientResponse get() throws FlexCheckedException, FlexRestException
public FlexRESTClientResponse post(java.lang.String pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse post(Entity pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse put(java.lang.String pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse put(Entity pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse patch(java.lang.String pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse patch(Entity pBody) throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse delete() throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse head() throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse trace() throws FlexRestException, FlexCheckedException
public FlexRESTClientResponse options() throws FlexRestException, FlexCheckedException
public FlexRESTClient url(java.lang.String pUrl)
pUrl
- - Url for rest api.public FlexRESTClient path(java.lang.String pPath)
pPath
- - Path/resource for rest api.public FlexRESTClient addOverrideCode(int pOverrideCode)
pOverrideCode
- - Rest response code that will be ignored if above 400 or cause an exception if under 400.public FlexRESTClient addOverrideCodes(java.util.Set<java.lang.Integer> pOverrideCodes)
pOverrideCodes
- - Set of Rest response codes that will be ignored if above 400 or cause an exception if under 400.public FlexRESTClient clearOverrideCodes()
public FlexRESTClient hostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
public FlexRESTClient sslContext(javax.net.ssl.SSLContext sslContext)
public FlexRESTClient setIgnoreSSLErrors(boolean pIgnoreSSLErrors)
pIgnoreSSLErrors
- - boolean representing whether or not SSL errors will be ignored.public FlexRESTClient setRegisterGZip(boolean pRegisterGZip)
pRegisterGZip
- - boolean representing whether or not register G zip is required.public FlexRESTClient queryparameters(java.util.Map<java.lang.String,java.lang.Object> pQueryParams)
pQueryParams
- - Map of query parameters to use in REST request.public FlexRESTClient queryparameters(java.lang.String pQueryParams)
public FlexRESTClient addQueryParameter(java.lang.String pKey, java.lang.Object pValue)
pKey
- pValue
- public FlexRESTClient mediatype(java.lang.String pMediaType)
pMediaType
- - Media type of the body that will be sent in the REST request.public FlexRESTClient mediatype(MediaType pMediaType)
pMediaType
- - Media type of the body that will be sent in the REST request.public FlexRESTClient accept(java.lang.String pMediaType)
pMediaType
- - Media type of the body that will be sent in the REST request.public FlexRESTClient accept(MediaType pMediaType)
pMediaType
- - Media type of the body that will be sent in the REST request.public FlexRESTClient headers(java.util.Map<java.lang.String,java.lang.Object> pHeaders)
pHeaders
- - Map of headers that will be sent in REST request.public FlexRESTClient addHeader(java.lang.String pKey, java.lang.Object pValue)
pKey
- pValue
- public FlexRESTClient setConnectTimeout(int pConnectTimeout)
pConnectTimeout
- - In millisecondspublic FlexRESTClient setReadTimeout(int pReadTimeout)
pReadTimeout
- - In millisecondspublic FlexRESTClient oauth(java.lang.String pToken)
pToken
- - OAuth token that will be used for REST request.public FlexRESTClient bearerToken(java.lang.String pToken)
pToken
- - OAuth token that will be used for REST request.public FlexRESTClient cookie(java.lang.String name, java.lang.String value)
public FlexRESTClient basicauth(java.lang.String user, java.lang.String password)
user
- password
- public FlexRESTClient basicauth(java.lang.String user, java.lang.String password, boolean isPreEmptive)
user
- - usernamepassword
- - passwordisPreEmptive
- public FlexRESTClient setValidateResponse(boolean pValidateResponse)
protected void validateResponse(FlexRESTClientResponse pResponse) throws FlexRestException
pResponse
- - response from REST request.FlexCheckedException
FlexRestException
public static Entity createFormData(java.util.List<FormDataBodyPart> formData)
formData
- public static Entity createFormData(FormDataBodyPart bodyPart)
bodyPart
- public static Entity createFormDataWithInputStream(java.util.Map<java.lang.String,java.lang.Object> form, java.lang.String inputStreamFileName)
public static Entity createFormData(java.util.Map<java.lang.String,java.lang.Object> form)