Class HttpRequestBody
- All Implemented Interfaces:
HttpRequest<HttpRequestWithBody>, HttpRequestWithBody
-
Field Summary
FieldsFields inherited from class BaseRequest
config, headers, method, url -
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestBody(Config config, HttpMethod method, String url) HttpRequestBody(HttpRequestBody baseRequest) -
Method Summary
Modifier and TypeMethodDescriptionbody(byte[] body) Set a byte array as the body of the requestbody(InputStream body) Set a InputStream as the bodySet a Object as the body of the request.Set a String as the body of the requestbody(JSONElement body) Sugar method for body operationSet JSON on the bodySet the Charset encoding for the Content-Type.contentType(String type) Sets a File on the body.Sets a File on the body with a specified content-type.field(String name, InputStream stream, String fileName) Sets a File on the body from a raw InputStream requires a file name.field(String name, InputStream stream, ContentType contentType, String fileName) Sets a File on the body from a raw InputStream requires a specified content-type and file name.Sets a field param on the body.Sets a field param on the body with a specified content-type.field(String name, Collection<?> value) Sets multiple field params on the body each with the same name.Sets multiple field params on the body from a map of key/value pairs.getBody()get the current default charsetForces the request to send as multipart even if all params are simpleMethods inherited from class BaseRequest
accept, asBytes, asBytesAsync, asBytesAsync, asEmpty, asEmptyAsync, asEmptyAsync, asFile, asFileAsync, asFileAsync, asJson, asJsonAsync, asJsonAsync, asObject, asObject, asObject, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asPaged, asString, asStringAsync, asStringAsync, basicAuth, cookie, cookie, cookie, downloadMonitor, equals, getCreationTime, getDownloadMonitor, getHeaders, getHttpMethod, getObjectMapper, getPath, getRequestTimeout, getUrl, getVersion, hashCode, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, requestTimeout, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapperMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HttpRequest
accept, accept, asBytes, asBytesAsync, asBytesAsync, asEmpty, asEmptyAsync, asEmptyAsync, asFile, asFileAsync, asFileAsync, asJson, asJsonAsync, asJsonAsync, asObject, asObject, asObject, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asPaged, asString, asStringAsync, asStringAsync, basicAuth, cookie, cookie, cookie, downloadMonitor, getCreationTime, getHeaders, getHttpMethod, getRequestTimeout, getUrl, getVersion, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, requestTimeout, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapperMethods inherited from interface HttpRequestWithBody
contentType, noCharset
-
Field Details
-
charSet
-
-
Constructor Details
-
HttpRequestBody
-
HttpRequestBody
-
-
Method Details
-
field
Description copied from interface:HttpRequestWithBodySets multiple field params on the body each with the same name.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the fieldvalue- a Collection of values- Returns:
- this request builder
-
field
Description copied from interface:HttpRequestWithBodySets a File on the body.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the file fieldfile- the file- Returns:
- this request builder
-
field
Description copied from interface:HttpRequestWithBodySets a File on the body with a specified content-type.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the file fieldfile- the filecontentType- contentType (i.e. image/png)- Returns:
- this request builder
-
field
Description copied from interface:HttpRequestWithBodySets a field param on the body.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the fieldvalue- a values- Returns:
- this request builder
-
field
Description copied from interface:HttpRequestWithBodySets a field param on the body with a specified content-type.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the fieldvalue- the objectcontentType- contentType (i.e. application/xml)- Returns:
- this request builder
-
fields
Description copied from interface:HttpRequestWithBodySets multiple field params on the body from a map of key/value pairs.- Specified by:
fieldsin interfaceHttpRequestWithBody- Parameters:
parameters- the map of field params- Returns:
- this request builder
-
field
public MultipartBody field(String name, InputStream stream, ContentType contentType, String fileName) Description copied from interface:HttpRequestWithBodySets a File on the body from a raw InputStream requires a specified content-type and file name.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the file fieldstream- the inputStreamcontentType- contentType (i.e. image/png)fileName- the name for the file- Returns:
- this request builder
-
multiPartContent
Description copied from interface:HttpRequestWithBodyForces the request to send as multipart even if all params are simple- Specified by:
multiPartContentin interfaceHttpRequestWithBody- Returns:
- The same MultipartBody
-
field
Description copied from interface:HttpRequestWithBodySets a File on the body from a raw InputStream requires a file name.- Specified by:
fieldin interfaceHttpRequestWithBody- Parameters:
name- the name of the file fieldstream- the inputStreamfileName- the name for the file- Returns:
- this request builder
-
charset
Description copied from interface:HttpRequestWithBodySet the Charset encoding for the Content-Type. This is appended to the Content-Type Header (e.g. application/x-www-form-urlencoded; charset=US-ASCII) Default is UTF-8- Specified by:
charsetin interfaceHttpRequestWithBody- Parameters:
charset- the charset- Returns:
- this request builder
-
body
Description copied from interface:HttpRequestWithBodySet JSON on the body- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- the JsonNode- Returns:
- this request builder
-
body
Description copied from interface:HttpRequestWithBodySet a String as the body of the request- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- the String- Returns:
- this request builder
-
body
Description copied from interface:HttpRequestWithBodySet a InputStream as the body- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- the Object- Returns:
- this request builder
-
body
Description copied from interface:HttpRequestWithBodySet a Object as the body of the request. This will be serialized with one of the following methods: - Strings are native - JSONElements use their native toString - Everything else will pass through the supplied ObjectMapper- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- the Object- Returns:
- this request builder
-
body
Description copied from interface:HttpRequestWithBodySet a byte array as the body of the request- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- the byte[]- Returns:
- this request builder
-
body
Sugar method for body operation- Specified by:
bodyin interfaceHttpRequestWithBody- Parameters:
body- raw JSONElement- Returns:
- RequestBodyEntity instance
-
getCharset
Description copied from interface:HttpRequestWithBodyget the current default charset- Specified by:
getCharsetin interfaceHttpRequestWithBody- Returns:
- the Charset
-
contentType
- Specified by:
contentTypein interfaceHttpRequestWithBody- Parameters:
type- The content mime type- Returns:
- this request builder
-
getBody
- Specified by:
getBodyin interfaceHttpRequest<HttpRequestWithBody>- Returns:
- if the request has a body it will be here.
-