Package kong.unirest.core
Class HttpRequestUniBody
- java.lang.Object
-
- kong.unirest.core.BaseRequest<RequestBodyEntity>
-
- kong.unirest.core.HttpRequestUniBody
-
- All Implemented Interfaces:
Body
,HttpRequest<RequestBodyEntity>
,RequestBodyEntity
class HttpRequestUniBody extends BaseRequest<RequestBodyEntity> implements RequestBodyEntity
-
-
Field Summary
Fields Modifier and Type Field Description private BodyPart
body
private java.nio.charset.Charset
charSet
private ProgressMonitor
monitor
-
Fields inherited from class kong.unirest.core.BaseRequest
config, headers, method, url
-
-
Constructor Summary
Constructors Constructor Description HttpRequestUniBody(HttpRequestBody httpRequest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestBodyEntity
body(byte[] bodyBytes)
Set a byte array as the body of the requestRequestBodyEntity
body(java.io.InputStream inputStreamBody)
Set a InputStream as the bodyRequestBodyEntity
body(java.lang.Object objectBody)
Set a Object as the body of the request.RequestBodyEntity
body(java.lang.String bodyAsString)
Set a String as the body of the requestRequestBodyEntity
body(JSONElement jsonBody)
Set JSON on the bodyRequestBodyEntity
body(JsonNode jsonBody)
Set JSON on the bodyRequestBodyEntity
charset(java.nio.charset.Charset charset)
Set the Charset encoding for the Content-Type.RequestBodyEntity
contentType(java.lang.String type)
java.util.Optional<Body>
getBody()
java.nio.charset.Charset
getCharset()
ProgressMonitor
getMonitor()
boolean
isEntityBody()
boolean
isMultiPart()
BodyPart
uniPart()
RequestBodyEntity
uploadMonitor(ProgressMonitor progressMonitor)
Set a Progress upload monitor suitable for drawing progress bars and whatnot.-
Methods inherited from class kong.unirest.core.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, connectTimeout, cookie, cookie, cookie, downloadMonitor, equals, getConnectTimeout, getCreationTime, getHeaders, getHttpMethod, getObjectMapper, getPath, getUrl, getVersion, hashCode, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapper
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface kong.unirest.core.Body
getField, getMode, multiParts
-
Methods inherited from interface kong.unirest.core.HttpRequest
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, connectTimeout, cookie, cookie, cookie, downloadMonitor, getConnectTimeout, getCreationTime, getHeaders, getHttpMethod, getUrl, getVersion, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapper
-
Methods inherited from interface kong.unirest.core.RequestBodyEntity
noCharset
-
-
-
-
Field Detail
-
body
private BodyPart body
-
charSet
private java.nio.charset.Charset charSet
-
monitor
private ProgressMonitor monitor
-
-
Constructor Detail
-
HttpRequestUniBody
HttpRequestUniBody(HttpRequestBody httpRequest)
-
-
Method Detail
-
body
public RequestBodyEntity body(JsonNode jsonBody)
Description copied from interface:RequestBodyEntity
Set JSON on the body- Specified by:
body
in interfaceRequestBodyEntity
- Parameters:
jsonBody
- the JsonNode- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.io.InputStream inputStreamBody)
Description copied from interface:RequestBodyEntity
Set a InputStream as the body- Specified by:
body
in interfaceRequestBodyEntity
- Parameters:
inputStreamBody
- the Object- Returns:
- this request builder
-
body
public RequestBodyEntity body(JSONElement jsonBody)
Description copied from interface:RequestBodyEntity
Set JSON on the body- Specified by:
body
in interfaceRequestBodyEntity
- Parameters:
jsonBody
- the JSONElement- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.lang.Object objectBody)
Description copied from interface:RequestBodyEntity
Set 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:
body
in interfaceRequestBodyEntity
- Parameters:
objectBody
- the Object- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.lang.String bodyAsString)
Description copied from interface:RequestBodyEntity
Set a String as the body of the request- Specified by:
body
in interfaceRequestBodyEntity
- Parameters:
bodyAsString
- the String- Returns:
- this request builder
-
body
public RequestBodyEntity body(byte[] bodyBytes)
Description copied from interface:RequestBodyEntity
Set a byte array as the body of the request- Specified by:
body
in interfaceRequestBodyEntity
- Parameters:
bodyBytes
- the byte[]- Returns:
- this request builder
-
charset
public RequestBodyEntity charset(java.nio.charset.Charset charset)
Description copied from interface:RequestBodyEntity
Set 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:
charset
in interfaceRequestBodyEntity
- Parameters:
charset
- the charset- Returns:
- this request builder
-
contentType
public RequestBodyEntity contentType(java.lang.String type)
- Specified by:
contentType
in interfaceRequestBodyEntity
- Parameters:
type
- The content mime type- Returns:
- this request builder
-
uploadMonitor
public RequestBodyEntity uploadMonitor(ProgressMonitor progressMonitor)
Description copied from interface:RequestBodyEntity
Set a Progress upload monitor suitable for drawing progress bars and whatnot. Works With- Specified by:
uploadMonitor
in interfaceRequestBodyEntity
- Parameters:
progressMonitor
- a monitor- Returns:
- The same MultipartBody
-
getBody
public java.util.Optional<Body> getBody()
- Specified by:
getBody
in interfaceHttpRequest<RequestBodyEntity>
- Returns:
- if the request has a body it will be here.
-
getCharset
public java.nio.charset.Charset getCharset()
- Specified by:
getCharset
in interfaceBody
-
isMultiPart
public boolean isMultiPart()
- Specified by:
isMultiPart
in interfaceBody
-
isEntityBody
public boolean isEntityBody()
- Specified by:
isEntityBody
in interfaceBody
-
getMonitor
public ProgressMonitor getMonitor()
- Specified by:
getMonitor
in interfaceBody
-
-