Package es.situm.sdk.communication
Class HttpRequest.Builder
- java.lang.Object
-
- es.situm.sdk.communication.HttpRequest.Builder
-
- Enclosing class:
- HttpRequest
public static final class HttpRequest.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(HttpRequest copy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpRequest.Builder
body(String body, String contentType)
Set a custom body with the specified content typeHttpRequest.Builder
bodyJson(String body)
Set the JSON body of the requestHttpRequest
build()
HttpRequest.Builder
callback(Handler<? super InputStream> callback)
Set the callback where you will be notified when the requests completes successfully or with an error.HttpRequest.Builder
customHeaders(Map<String,String> customHeaders)
Set custom headers of the requestHttpRequest.Builder
method(String method)
Set the HTTP method.HttpRequest.Builder
options(Map<String,Object> options)
Set custom options.HttpRequest.Builder
requestParams(Map<String,Object> requestParams)
Set request paramsHttpRequest.Builder
responseDestinationFile(File file)
Set the file where the response will be writenHttpRequest.Builder
url(String relativeUrl)
Set the relative url to send the request
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(@NonNull HttpRequest copy)
-
-
Method Detail
-
url
@NonNull public HttpRequest.Builder url(@NonNull String relativeUrl)
Set the relative url to send the request
-
method
@NonNull public HttpRequest.Builder method(@NonNull String method)
Set the HTTP method. Can be one ofHttpMethod
-
bodyJson
@NonNull public HttpRequest.Builder bodyJson(@NonNull String body)
Set the JSON body of the request
-
body
@NonNull public HttpRequest.Builder body(@NonNull String body, @NonNull String contentType)
Set a custom body with the specified content type
-
requestParams
@NonNull public HttpRequest.Builder requestParams(@NonNull Map<String,Object> requestParams)
Set request params
-
customHeaders
@NonNull public HttpRequest.Builder customHeaders(@NonNull Map<String,String> customHeaders)
Set custom headers of the request
-
options
@NonNull public HttpRequest.Builder options(@NonNull Map<String,Object> options)
Set custom options. SeeHttpOption
-
responseDestinationFile
@NonNull public HttpRequest.Builder responseDestinationFile(@NonNull File file)
Set the file where the response will be writen- Parameters:
file
-- Returns:
-
callback
@NonNull public HttpRequest.Builder callback(@NonNull Handler<? super InputStream> callback)
Set the callback where you will be notified when the requests completes successfully or with an error.
-
build
@NonNull public HttpRequest build()
-
-