public class RequestBuilder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
RequestBuilder |
body(okhttp3.RequestBody body)
Sets the body.
|
RequestBuilder |
bodyContent(java.lang.String content,
java.lang.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(java.lang.String url)
The DELETE method requests that the origin server delete the resource identified by the Request-URI.
|
RequestBuilder |
form(java.lang.Object... args)
Adds form parameters.
|
static RequestBuilder |
get(java.lang.String url)
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
|
RequestBuilder |
header(java.lang.Object... args)
Adds header parameters.
|
static RequestBuilder |
post(java.lang.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(java.lang.String url)
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
|
RequestBuilder |
query(java.lang.Object... args)
Adds query parameters.
|
java.lang.String |
toString() |
public static RequestBuilder delete(java.lang.String url)
url
- the URLpublic static RequestBuilder get(java.lang.String url)
url
- the URLpublic static RequestBuilder post(java.lang.String url)
url
- the URLpublic static RequestBuilder put(java.lang.String url)
url
- the URLpublic okhttp3.Request build()
public java.lang.String toString()
toString
in class java.lang.Object
public RequestBuilder body(okhttp3.RequestBody body)
body
- the bodypublic RequestBuilder bodyContent(java.lang.String content, java.lang.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(java.lang.Object... args)
args
- a list of name-value form parameterspublic RequestBuilder header(java.lang.Object... args)
args
- a list of name-value headerspublic RequestBuilder query(java.lang.Object... args)
args
- a list of name-value query parameters