Package sonia.scm.net.ahc
Class AdvancedHttpRequestWithBody
java.lang.Object
sonia.scm.net.ahc.BaseHttpRequest<AdvancedHttpRequestWithBody>
sonia.scm.net.ahc.AdvancedHttpRequestWithBody
Http request with body.
- Since:
- 1.46
- 
Field SummaryFields inherited from class sonia.scm.net.ahc.BaseHttpRequestclient
- 
Method SummaryModifier and TypeMethodDescriptioncontentLength(long length) Sets the content length for the request.contentType(String contentType) Sets the content type for the request.fileContent(File file) Sets the content of the file as request content.Returns aFormContentBuilder.Returns the content or the request.jsonContent(Object object) Transforms the given object to a json string and set this string as request content.rawContent(byte[] data) Sets the raw data as request content.rawContent(com.google.common.io.ByteSource source) Sets the raw data as request content.protected AdvancedHttpRequestWithBodyself()Implementing classes should returnthis.stringContent(String content) Sets the string as request content.stringContent(String content, Charset charset) Sets the string as request content.transformedContent(String contentType, Object object) Transforms the given object to a string and set this string as request content.xmlContent(Object object) Transforms the given object to a xml string and set this string as request content.Methods inherited from class sonia.scm.net.ahc.BaseHttpRequestacceptStatusCodes, basicAuth, decodeGZip, disableCertificateValidation, disableHostnameValidation, disableTracing, encoded, getAcceptedStatus, getHeaders, getMethod, getSpanKind, getUrl, header, headers, ignoreProxySettings, isDecodeGZip, isDisableCertificateValidation, isDisableHostnameValidation, isIgnoreProxySettings, queryString, queryStrings, request, spanKind, toString
- 
Method Details- 
contentLengthSets the content length for the request.- Returns:
- this
 
- 
contentTypeSets the content type for the request.- Returns:
- this
 
- 
fileContentSets the content of the file as request content.- Returns:
- this
 
- 
formContentReturns aFormContentBuilder. The builder can be used to add form parameters as content for the request. Note: you have to callFormContentBuilder.build()in order to apply the form content to the request.- Returns:
- form content builder
 
- 
jsonContentTransforms the given object to a json string and set this string as request content.- Parameters:
- object- object to transform
- Returns:
- this
- Throws:
- ContentTransformerNotFoundException- if no- ContentTransformercould be found for the json content-type
 
- 
rawContentSets the raw data as request content.- Returns:
- this
 
- 
rawContentSets the raw data as request content.- Returns:
- this
 
- 
stringContentSets the string as request content.- Returns:
- this
 
- 
stringContentSets the string as request content.- Parameters:
- content- string content
- charset- charset of content
- Returns:
- this
 
- 
transformedContentTransforms the given object to a string and set this string as request content. The content-type is used to pick the rightContentTransformer. The method will throw an exception if noContentTransformerfor the content-type could be found.- Parameters:
- contentType- content-type
- object- object to transform
- Returns:
- this
- Throws:
- ContentTransformerNotFoundException- if no- ContentTransformercould be found for the given content-type
 
- 
xmlContentTransforms the given object to a xml string and set this string as request content.- Parameters:
- object- object to transform
- Returns:
- this
- Throws:
- ContentTransformerNotFoundException- if no- ContentTransformercould be found for the xml content-type
 
- 
getContentReturns the content or the request.
- 
selfDescription copied from class:BaseHttpRequestImplementing classes should returnthis.- Specified by:
- selfin class- BaseHttpRequest<AdvancedHttpRequestWithBody>
- Returns:
- request instance
 
 
-