public class RequestBuilder extends Object
Modifier and Type | Method and Description |
---|---|
RequestBuilder |
body(okhttp3.RequestBody body)
Sets the body.
|
RequestBuilder |
bodyContent(String content,
String contentType)
Sets the string content to the request (used with POST/PUT).
|
RequestBuilder |
bodyJson(com.google.gson.JsonObject json)
Adds a JSON content to the request (used with POST/PUT).
|
okhttp3.Request |
build()
Builds the.
|
static RequestBuilder |
delete(String url)
The DELETE method requests that the origin server delete the resource identified by the Request-URI.
|
RequestBuilder |
form(Object... args)
Adds form parameters.
|
static RequestBuilder |
get(String url)
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
|
RequestBuilder |
header(Object... args)
Adds header parameters.
|
static RequestBuilder |
post(String url)
The POST request method is designed to request that a web server accept the data enclosed in the request message's
body for storage.
|
static RequestBuilder |
put(String url)
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
|
RequestBuilder |
query(Object... args)
Adds query parameters.
|
String |
toString() |
public static RequestBuilder delete(String url)
url
- the URLpublic static RequestBuilder get(String url)
url
- the URLpublic static RequestBuilder post(String url)
url
- the URLpublic static RequestBuilder put(String url)
url
- the URLpublic okhttp3.Request build()
public RequestBuilder body(okhttp3.RequestBody body)
body
- the bodypublic RequestBuilder bodyContent(String content, String contentType)
RequestBody
encoded with UTF-8content
- the content to POST/PUTcontentType
- the HTTP contentType to use.public RequestBuilder bodyJson(com.google.gson.JsonObject json)
RequestBody
encoded with UTF-8 and use "application/json"
as Content-Typejson
- the JsonObject jsonpublic RequestBuilder form(Object... args)
args
- a list of name-value form parameterspublic RequestBuilder header(Object... args)
args
- a list of name-value headerspublic RequestBuilder query(Object... args)
args
- a list of name-value query parametersCopyright © 2015–2016 IBM Watson. All rights reserved.