public interface RequestInterface<T extends Response>
| Modifier and Type | Method and Description |
|---|---|
void |
addAdditionalAllowedStatusCode(int code)
Add an additional allowed status code
|
void |
addAdditionalDeniedStatusCode(int code)
Add an denied status code
|
void |
addHeaders(String name,
String value)
Add a new header property
|
void |
addQueryParam(String name,
String value)
Add a new query property
|
T |
execute()
Executes the request and returns a deserialized object of the response based on T
|
ArrayList<Integer> |
getAdditionalAllowedStatusCodes()
Get all additional allowed status codes
|
ArrayList<Integer> |
getAdditionalDeniedStatusCodes()
Get all additional denied status codes
|
HashMap<String,String> |
getHeaderMap()
Get the header map of the request
key: property name
value: property value
Example:
{"Accept-Charset": "UTF-8"}
|
String |
getMediaType()
Get media type (Content-Type property) of the request
|
Class<T> |
getParameterClass()
Get the generic class T
|
String |
getPath()
Set path of the request
Examples:
- /post/1
- /user/12/address
|
HashMap<String,String> |
getQueryParamMap()
Get the query map of the request
key: property name
value: property value
Example:
{"definitionId": "12974", "active": "true"} = ?definitionId=12974&active=true
|
HashMap<String,Object> |
getRESTFilters()
Get the RESTFilters for the Request/Response
|
ArrayList<RESTFilter> |
getRESTFilters(FilterTypes filterType)
Get the RESTFilters of a specific type for the Request/Response
|
String |
getUrl()
Get the url of the request
Examples:
- http://rest.viascom.ch:8000
- https://127.0.0.1:8080
|
void |
prepareQuery()
Generate request url with all informations for the request
|
void |
register(RESTFilter restFilter)
Register a RESTFilters for the Request/Response
|
Object |
request()
Send request to the rest endpoint
|
void |
setAdditionalAllowedStatusCodes(ArrayList<Integer> additionalAllowedStatusCodes)
Set additional allowed status codes
this will extend the default of statuscode >= 200 && < 300
|
void |
setAdditionalDeniedStatusCodes(ArrayList<Integer> additionalDeniedStatusCodes)
Set additional denied status codes
this will override the default of statuscode >= 200 && < 300
|
void |
setHeaderMap(HashMap<String,String> headerMap)
Set the header map of the request
key: property name
value: property value
Example:
{"Accept-Charset": "UTF-8"}
|
void |
setMediaType(String mediaType)
Set media type (Content-Type property) of the request
|
void |
setPath(String path)
Get path of the request
Examples:
- /post/1
- /user/12/address
|
void |
setQueryParamMap(HashMap<String,String> queryParamMap)
Set the query map of the request
key: property name
value: property value
Example:
{"definitionId": "12974", "active": "true"} = ?definitionId=12974&active=true
|
void |
setRequestParams(ArrayList<String> params,
Object o)
Set query map of the request based on a objects and its attributes
|
void |
setUrl(String url)
Set url of the request
Examples:
- http://rest.viascom.ch:8000
- https://127.0.0.1:8080
|
void |
unregister(Class restFilter)
Unregister a RESTFilters for the Request/Response
|
String getUrl()
void setUrl(String url)
url - url to the rest endpointString getPath()
void setPath(String path)
path - path to the rest endpointString getMediaType()
void setMediaType(String mediaType)
mediaType - media typeHashMap<String,String> getQueryParamMap()
void setQueryParamMap(HashMap<String,String> queryParamMap)
queryParamMap - hash map containing the query propertiesvoid setRequestParams(ArrayList<String> params, Object o) throws RESTClientException
params - list of attribute names which are used for the query mapo - object with the attributesRESTClientExceptionvoid addQueryParam(String name, String value)
name - property namevalue - propert valueHashMap<String,String> getHeaderMap()
void setHeaderMap(HashMap<String,String> headerMap)
headerMap - hash map containing the header propertiesvoid addHeaders(String name, String value)
name - property namevalue - propert valuevoid register(RESTFilter restFilter)
restFilter - RESTFilter for the requestvoid unregister(Class restFilter)
restFilter - Class of a restFilter for the requestHashMap<String,Object> getRESTFilters()
ArrayList<RESTFilter> getRESTFilters(FilterTypes filterType)
void setAdditionalAllowedStatusCodes(ArrayList<Integer> additionalAllowedStatusCodes)
additionalAllowedStatusCodes - Array of additional allowed status codesArrayList<Integer> getAdditionalAllowedStatusCodes()
void addAdditionalAllowedStatusCode(int code)
code - status code to allowvoid setAdditionalDeniedStatusCodes(ArrayList<Integer> additionalDeniedStatusCodes)
additionalDeniedStatusCodes - Array of additional denied status codesArrayList<Integer> getAdditionalDeniedStatusCodes()
void addAdditionalDeniedStatusCode(int code)
code - status code to denievoid prepareQuery()
throws Exception
ExceptionObject request() throws Exception
ExceptionT execute() throws Exception
ExceptionCopyright © 2016. All rights reserved.