public abstract class RequestBody<T> extends Object implements Serializable
| 限定符 | 构造器和说明 |
|---|---|
protected |
RequestBody(T body,
String contentType,
boolean includeCharset) |
| 限定符和类型 | 方法和说明 |
|---|---|
T |
body()
The request body
|
static RequestBody<byte[]> |
bytes(byte[] value)
Create request body send byte array data
|
String |
contentType()
the content type
|
RequestBody<T> |
contentType(String contentType)
Set content-type value for this request body
|
static RequestBody<File> |
file(File file)
Create request body from file
|
static RequestBody<Collection<? extends Map.Entry<String,?>>> |
form(Collection<? extends Map.Entry<String,?>> params)
Create request body send x-www-form-encoded data
|
static RequestBody<Collection<? extends Map.Entry<String,?>>> |
form(Map.Entry<String,?>... params)
Create request body send x-www-form-encoded data
|
T |
getBody()
已过时。
use
body() |
String |
getContentType()
已过时。
use
contentType() |
boolean |
includeCharset()
If write charset to contentType
|
static RequestBody<InputStream> |
inputStream(InputStream in)
已过时。
Http body may be send multi times(because of redirect or other reasons), use
inputStream(InputStreamSupplier) )} instead. |
static RequestBody<InputStreamSupplier> |
inputStream(InputStreamSupplier supplier)
Create request body from input stream.
|
boolean |
isIncludeCharset()
已过时。
use
includeCharset() |
static <T> RequestBody<T> |
json(T value)
Create request body send json data
|
static RequestBody<Collection<? extends Part<?>>> |
multiPart(Collection<? extends Part<?>> parts)
Create multi-part post request body
|
RequestBody<T> |
setContentType(String contentType)
已过时。
|
static RequestBody<String> |
text(String value)
Create request body send string data
|
abstract void |
writeBody(OutputStream out,
Charset charset)
Write Request body.
|
void |
writeTo(OutputStream out,
Charset charset)
Write the request body to output stream.
|
@Deprecated public T getBody()
body()public T body()
@Deprecated public RequestBody<T> setContentType(String contentType)
contentType(String)public RequestBody<T> contentType(String contentType)
@Deprecated public String getContentType()
contentType()public String contentType()
@Deprecated public boolean isIncludeCharset()
includeCharset()public boolean includeCharset()
public void writeTo(OutputStream out, Charset charset) throws IOException
out - the output stream to writeTo tocharset - the charset to useIOExceptionpublic abstract void writeBody(OutputStream out, Charset charset) throws IOException
IOExceptionpublic static <T> RequestBody<T> json(T value)
public static RequestBody<String> text(String value)
public static RequestBody<Collection<? extends Map.Entry<String,?>>> form(Collection<? extends Map.Entry<String,?>> params)
public static RequestBody<Collection<? extends Map.Entry<String,?>>> form(Map.Entry<String,?>... params)
public static RequestBody<byte[]> bytes(byte[] value)
@Deprecated public static RequestBody<InputStream> inputStream(InputStream in)
inputStream(InputStreamSupplier) )} instead.public static RequestBody<InputStreamSupplier> inputStream(InputStreamSupplier supplier)
public static RequestBody<File> file(File file)
public static RequestBody<Collection<? extends Part<?>>> multiPart(Collection<? extends Part<?>> parts)
Copyright © 2019. All rights reserved.