public class RESTAPICallPreHandler extends Object implements APICallPreHandler
APICallPreHandler for REST API calls.
The implementation is PayPal specific, To do custom implementation override
the protected methods| Constructor and Description |
|---|
RESTAPICallPreHandler(Map<String,String> configurationMap)
Constructor using configurations dynamically
|
RESTAPICallPreHandler(Map<String,String> configurationMap,
Map<String,String> headersMap)
Constructor using a Map of headers for forming custom headers
|
| Modifier and Type | Method and Description |
|---|---|
protected Map<String,String> |
formUserAgentHeader()
Returns User-Agent header
|
URL |
getBaseURL()
Returns the base URL configured in application resources or
Map
passed for dynamic configuration |
ICredential |
getCredential()
Returns
ICredential configured for the api call |
String |
getEndPoint()
Returns the endpoint for the API call.
|
Map<String,String> |
getHeaderMap()
Returns HTTP headers as a
Map |
String |
getPayLoad()
Returns the payload for the API call.
|
protected String |
getProcessedEndPoint()
Override this method to process EndPoint
|
protected Map<String,String> |
getProcessedHeaderMap()
Override this method to return a
Map of HTTP headers |
protected String |
getProcessedPayLoad()
Override this method to process payload for processing
|
void |
setAuthorizationToken(String authorizationToken) |
void |
setPayLoad(String payLoad) |
void |
setRequestId(String requestId) |
void |
setResourcePath(String resourcePath) |
void |
setSdkVersion(SDKVersion sdkVersion) |
void |
setUrl(String urlString) |
void |
validate()
Validates settings and integrity before call
|
public RESTAPICallPreHandler(Map<String,String> configurationMap)
configurationMap - Map used for dynamic configurationpublic void setAuthorizationToken(String authorizationToken)
authorizationToken - the authorizationToken to setpublic void setResourcePath(String resourcePath)
resourcePath - the resourcePath to setpublic void setRequestId(String requestId)
requestId - the requestId to setpublic void setPayLoad(String payLoad)
payLoad - the payLoad to setpublic void setSdkVersion(SDKVersion sdkVersion)
sdkVersion - the sdkVersion to setpublic Map<String,String> getHeaderMap()
MapgetHeaderMap in interface APICallPreHandlerMap of Http headerspublic String getPayLoad()
APICallPreHandlergetPayLoad in interface APICallPreHandlerpublic String getEndPoint()
APICallPreHandlerConstants)are taken to be default for the API call.getEndPoint in interface APICallPreHandlerpublic ICredential getCredential()
APICallPreHandlerICredential configured for the api callgetCredential in interface APICallPreHandlerpublic void validate()
throws ClientActionRequiredException
APICallPreHandlervalidate in interface APICallPreHandlerClientActionRequiredExceptionpublic URL getBaseURL() throws MalformedURLException
Map
passed for dynamic configurationURLMalformedURLException - if endpoint cannot be found or formedpublic void setUrl(String urlString) throws MalformedURLException
urlString - the url to setMalformedURLExceptionprotected Map<String,String> formUserAgentHeader()
Map storing the User-Agent headerprotected String getProcessedEndPoint()
protected Map<String,String> getProcessedHeaderMap()
Map of HTTP headersMap of HTTP headersprotected String getProcessedPayLoad()
Copyright © 2016. All Rights Reserved.