Package com.batch.android
Class BatchWebservice
- java.lang.Object
-
- com.batch.android.core.Webservice
-
- com.batch.android.BatchWebservice
-
- Direct Known Subclasses:
InboxFetchWebserviceClient,InboxSyncWebserviceClient,LocalCampaignsWebservice
public abstract class BatchWebservice extends Webservice
Batch webservice that extendsWebserviceand can accessSystemParameterHelper.
Contains common methods to all webservices
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.batch.android.core.Webservice
Webservice.RequestType, Webservice.WebserviceError
-
-
Field Summary
Fields Modifier and Type Field Description protected WebserviceErrorCauselastFailureCauseCause of the last try failureprotected intretryCountNumber of retry done for this query-
Fields inherited from class com.batch.android.core.Webservice
applicationContext, headers, isDowngradedCipher
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBatchWebservice(android.content.Context context, Webservice.RequestType type, java.lang.String baseURLFormat, java.lang.String... parameters)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddDefaultHeaders()Add default headers to the WS requestprotected PostDataProvider<JSONObject>getPostDataProvider()Return the POST body you want to add to the requestprotected abstract java.lang.StringgetPropertyParameterKey()Get property parameter key to add parameter to the get chainprotected voidhandleParameters(JSONObject body)Read parameters from ws responseprotected voidhandleServerID(JSONObject body)Read server id from ws responseprotected voidonRetry(WebserviceErrorCause cause)Called when a retry is made after a failure
Nothing done here, but child may want to override it-
Methods inherited from class com.batch.android.core.Webservice
addBatchApiKey, addDefaultParameters, addGetParameter, addHeaders, addParameters, addRequestSignatures, buildConnection, buildParameters, buildURL, canBypassOptOut, encode, executeRequest, formatDate, getBasicJsonResponseBody, getCryptorModeParameterKey, getCryptorTypeParameterKey, getHeaders, getParameters, getPostCryptorTypeParameterKey, getReadCryptorTypeParameterKey, getResponseErrorCause, getSignatureBody, getSpecificConnectTimeoutKey, getSpecificReadTimeoutKey, getSpecificRetryCountKey, getStandardResponseBodyIfValid, getURLSorterPatternParameterKey, isResponseValid
-
-
-
-
Field Detail
-
retryCount
protected int retryCount
Number of retry done for this query
-
lastFailureCause
protected WebserviceErrorCause lastFailureCause
Cause of the last try failure
-
-
Constructor Detail
-
BatchWebservice
protected BatchWebservice(android.content.Context context, Webservice.RequestType type, java.lang.String baseURLFormat, java.lang.String... parameters) throws java.net.MalformedURLException- Parameters:
context-baseURLFormat- an url to format with api key (ex : http://sample.com/%s/sample)- Throws:
java.net.MalformedURLException
-
-
Method Detail
-
addDefaultHeaders
protected void addDefaultHeaders()
Description copied from class:WebserviceAdd default headers to the WS request- Overrides:
addDefaultHeadersin classWebservice
-
getPostDataProvider
protected PostDataProvider<JSONObject> getPostDataProvider()
Description copied from class:WebserviceReturn the POST body you want to add to the request- Specified by:
getPostDataProviderin classWebservice- Returns:
- the post data provider if any, null otherwise
-
onRetry
protected void onRetry(WebserviceErrorCause cause)
Description copied from class:WebserviceCalled when a retry is made after a failure
Nothing done here, but child may want to override it- Overrides:
onRetryin classWebservice
-
getPropertyParameterKey
protected abstract java.lang.String getPropertyParameterKey()
Get property parameter key to add parameter to the get chain- Returns:
- property key or null if no property is wanted for this webservice
-
handleParameters
protected void handleParameters(JSONObject body)
Read parameters from ws response- Parameters:
body-
-
handleServerID
protected void handleServerID(JSONObject body)
Read server id from ws response- Parameters:
body-
-
-