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 BodyPartbodyprivate java.nio.charset.CharsetcharSetprivate ProgressMonitormonitor-
Fields inherited from class kong.unirest.core.BaseRequest
config, headers, method, url
-
-
Constructor Summary
Constructors Constructor Description HttpRequestUniBody(HttpRequestBody httpRequest)HttpRequestUniBody(HttpRequestUniBody httpRequest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestBodyEntitybody(byte[] bodyBytes)Set a byte array as the body of the requestRequestBodyEntitybody(java.io.InputStream inputStreamBody)Set a InputStream as the bodyRequestBodyEntitybody(java.lang.Object objectBody)Set a Object as the body of the request.RequestBodyEntitybody(java.lang.String bodyAsString)Set a String as the body of the requestRequestBodyEntitybody(JSONElement jsonBody)Set JSON on the bodyRequestBodyEntitybody(JsonNode jsonBody)Set JSON on the bodyRequestBodyEntitycharset(java.nio.charset.Charset charset)Set the Charset encoding for the Content-Type.RequestBodyEntitycontentType(java.lang.String type)java.util.Optional<Body>getBody()java.nio.charset.CharsetgetCharset()ProgressMonitorgetMonitor()booleanisEntityBody()booleanisMultiPart()BodyPartuniPart()RequestBodyEntityuploadMonitor(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, 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, 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
getBoundary, getField, getMode, multiParts
-
Methods inherited from interface kong.unirest.core.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, 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)
-
HttpRequestUniBody
HttpRequestUniBody(HttpRequestUniBody httpRequest)
-
-
Method Detail
-
body
public RequestBodyEntity body(JsonNode jsonBody)
Description copied from interface:RequestBodyEntitySet JSON on the body- Specified by:
bodyin interfaceRequestBodyEntity- Parameters:
jsonBody- the JsonNode- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.io.InputStream inputStreamBody)
Description copied from interface:RequestBodyEntitySet a InputStream as the body- Specified by:
bodyin interfaceRequestBodyEntity- Parameters:
inputStreamBody- the Object- Returns:
- this request builder
-
body
public RequestBodyEntity body(JSONElement jsonBody)
Description copied from interface:RequestBodyEntitySet JSON on the body- Specified by:
bodyin interfaceRequestBodyEntity- Parameters:
jsonBody- the JSONElement- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.lang.Object objectBody)
Description copied from interface:RequestBodyEntitySet 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 interfaceRequestBodyEntity- Parameters:
objectBody- the Object- Returns:
- this request builder
-
body
public RequestBodyEntity body(java.lang.String bodyAsString)
Description copied from interface:RequestBodyEntitySet a String as the body of the request- Specified by:
bodyin interfaceRequestBodyEntity- Parameters:
bodyAsString- the String- Returns:
- this request builder
-
body
public RequestBodyEntity body(byte[] bodyBytes)
Description copied from interface:RequestBodyEntitySet a byte array as the body of the request- Specified by:
bodyin interfaceRequestBodyEntity- Parameters:
bodyBytes- the byte[]- Returns:
- this request builder
-
charset
public RequestBodyEntity charset(java.nio.charset.Charset charset)
Description copied from interface:RequestBodyEntitySet 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 interfaceRequestBodyEntity- Parameters:
charset- the charset- Returns:
- this request builder
-
contentType
public RequestBodyEntity contentType(java.lang.String type)
- Specified by:
contentTypein interfaceRequestBodyEntity- Parameters:
type- The content mime type- Returns:
- this request builder
-
uploadMonitor
public RequestBodyEntity uploadMonitor(ProgressMonitor progressMonitor)
Description copied from interface:RequestBodyEntitySet a Progress upload monitor suitable for drawing progress bars and whatnot. Works With- Specified by:
uploadMonitorin interfaceRequestBodyEntity- Parameters:
progressMonitor- a monitor- Returns:
- The same MultipartBody
-
getBody
public java.util.Optional<Body> getBody()
- Specified by:
getBodyin interfaceHttpRequest<RequestBodyEntity>- Returns:
- if the request has a body it will be here.
-
getCharset
public java.nio.charset.Charset getCharset()
- Specified by:
getCharsetin interfaceBody
-
isMultiPart
public boolean isMultiPart()
- Specified by:
isMultiPartin interfaceBody
-
isEntityBody
public boolean isEntityBody()
- Specified by:
isEntityBodyin interfaceBody
-
getMonitor
public ProgressMonitor getMonitor()
- Specified by:
getMonitorin interfaceBody
-
-