public class HttpRequestBodies extends Object
| Constructor and Description |
|---|
HttpRequestBodies() |
| Modifier and Type | Method and Description |
|---|---|
static HttpRequestBody |
fileBody(File file)
Create request body from given
file. |
static HttpRequestBody |
fileBody(File file,
String contentType)
Create request body from given
file. |
static HttpRequestBody |
fileBody(Path path)
Create request body from given
file. |
static HttpRequestBody |
fileBody(Path path,
String contentType)
Create request body from given
file. |
static HttpRequestBodyFormBuilder |
formBuilder()
Create builder that can be used to create form urlencoded request body.
|
static HttpRequestBody |
formUrlEncodedBody(Collection<HttpParameter> parameters)
Create form urlencoded body from given parameters.
|
static HttpRequestBody |
formUrlEncodedBody(HttpParameter parameter,
HttpParameter... others)
Create form urlencoded body from given parameters.
|
static HttpRequestBody |
formUrlEncodedBody(Map<String,String> parameters)
Create form urlencoded body from given parameters.
|
static HttpRequestBody |
jpeg(File file)
Create request body from given
file, defined with "image/jpeg" content type. |
static HttpRequestBody |
jpeg(Path path)
Create request body from given
path, defined with "image/jpeg" content type. |
static HttpRequestBody |
jsonBody(String body)
Create request body from given raw string and
"application/json" content type. |
static HttpRequestBodyMultipartBuilder |
multipartBuilder()
Create builder that can be used to create multipart request body.
|
static HttpRequestBody |
pdf(File file)
Create request body from given
file, defined with "application/pdf" content type. |
static HttpRequestBody |
pdf(Path path)
Create request body from given
path, defined with "application/pdf" content type. |
static HttpRequestBody |
png(File file)
Create request body from given
file, defined with "image/png" content type. |
static HttpRequestBody |
png(Path path)
Create request body from given
path, defined with "image/png" content type. |
static HttpRequestBody |
requestBody(String body)
Create request body from given raw string.
|
static HttpRequestBody |
textBody(String body)
Create request body from given raw string and
"text/plain" content type. |
static HttpRequestBody |
xmlBody(String body)
Create request body from given raw string and
"application/xml" content type. |
public static HttpRequestBody requestBody(String body)
body - The body string.NullPointerException - If body is nullpublic static HttpRequestBody jsonBody(String body)
"application/json" content type.body - The JSON body string.NullPointerException - If body is nullpublic static HttpRequestBody xmlBody(String body)
"application/xml" content type.body - The XML body string.NullPointerException - If body is nullpublic static HttpRequestBody textBody(String body)
"text/plain" content type.body - The body string.NullPointerException - If body is nullpublic static HttpRequestBody fileBody(File file)
file.file - The body file.NullPointerException - If file is nullpublic static HttpRequestBody jpeg(File file)
file, defined with "image/jpeg" content type.file - The body file.NullPointerException - If file is nullpublic static HttpRequestBody jpeg(Path path)
path, defined with "image/jpeg" content type.path - The body path.NullPointerException - If file is nullpublic static HttpRequestBody png(File file)
file, defined with "image/png" content type.file - The body file.NullPointerException - If file is nullpublic static HttpRequestBody png(Path path)
path, defined with "image/png" content type.path - The body file.NullPointerException - If file is nullpublic static HttpRequestBody pdf(File file)
file, defined with "application/pdf" content type.file - The body file.NullPointerException - If file is nullpublic static HttpRequestBody pdf(Path path)
path, defined with "application/pdf" content type.path - The body file.NullPointerException - If file is nullpublic static HttpRequestBody fileBody(File file, String contentType)
file.file - The body file.contentType - The content type.NullPointerException - If file or contentType are nullIllegalArgumentException - If contentType is empty or blank.public static HttpRequestBody fileBody(Path path)
file.path - The body file.NullPointerException - If path is nullpublic static HttpRequestBody fileBody(Path path, String contentType)
file.path - The body file.contentType - The content type.NullPointerException - If path or contentType are nullIllegalArgumentException - If contentType is empty or blank.public static HttpRequestBody formUrlEncodedBody(Map<String,String> parameters)
parameters - Body parameters.public static HttpRequestBody formUrlEncodedBody(Collection<HttpParameter> parameters)
parameters - Body parameters.public static HttpRequestBody formUrlEncodedBody(HttpParameter parameter, HttpParameter... others)
public static HttpRequestBodyFormBuilder formBuilder()
public static HttpRequestBodyMultipartBuilder multipartBuilder()
Copyright © 2019. All rights reserved.