Package io.didomi.sdk.remote
Class HttpRequestHelper
- java.lang.Object
-
- io.didomi.sdk.remote.HttpRequestHelper
-
public class HttpRequestHelper extends java.lang.ObjectWrapper created to abstract HTTP requests.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_TIMEOUT
-
Constructor Summary
Constructors Constructor Description HttpRequestHelper(io.didomi.sdk.user.UserAgentRepository userAgentRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoGetCall(java.lang.String urlString, HttpResponseJSONListener listener)Method used to do GET calls and parse the response as JSONvoiddoGetCall(java.lang.String urlString, HttpResponseStringListener listener, int timeout, long ifModifiedSince)Method used to do GET callsvoiddoPostCall(java.lang.String urlString, java.lang.String content, HttpResponseJSONListener listener)Method used to do POST calls and parse the response as JSONvoiddoPostCall(java.lang.String urlString, java.lang.String content, HttpResponseStringListener listener)Method used to do POST callsvoiddoPostCall(java.lang.String urlString, java.lang.String content, HttpResponseStringListener listener, int timeout)Method used to do POST calls with custom timeout
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
doGetCall
public void doGetCall(java.lang.String urlString, HttpResponseStringListener listener, int timeout, long ifModifiedSince)Method used to do GET calls- Parameters:
urlString- URL to calllistener- listener receiving request responsetimeout- request timeoutifModifiedSince- Timestamp (in ms) for the If-Modified-Since header, or 0. If the file was not modified on server, onSuccess will be called with an empty response.
-
doGetCall
public void doGetCall(java.lang.String urlString, HttpResponseJSONListener listener)Method used to do GET calls and parse the response as JSON- Parameters:
urlString- URL to calllistener- listener receiving request response
-
doPostCall
public void doPostCall(java.lang.String urlString, java.lang.String content, HttpResponseStringListener listener)Method used to do POST calls- Parameters:
urlString- URL to callcontent- body content (mandatory)listener- listener receiving request response
-
doPostCall
public void doPostCall(java.lang.String urlString, java.lang.String content, HttpResponseStringListener listener, int timeout)Method used to do POST calls with custom timeout- Parameters:
urlString- URL to callcontent- body content (mandatory)listener- listener receiving request responsetimeout- request timeout
-
doPostCall
public void doPostCall(java.lang.String urlString, java.lang.String content, HttpResponseJSONListener listener)Method used to do POST calls and parse the response as JSON- Parameters:
urlString- URL to callcontent- body content (mandatory)listener- listener receiving request response
-
-