Abstract class for building HTTP messages
- The implementing typeType | Name and description |
---|---|
java.nio.charset.Charset |
charset |
io.netty.handler.codec.http.FullHttpMessage |
httpMessage |
java.io.Writer |
writer The writer for the request body |
Constructor and description |
---|
HttpMessageBuilder
(io.netty.handler.codec.http.FullHttpMessage httpMessage, java.nio.charset.Charset charset) |
Type | Name and description |
---|---|
T |
contentType(java.lang.CharSequence contentType) Sets the content type for the request |
protected void |
defaultContentType(io.netty.handler.codec.http.HttpHeaders headers, java.lang.String contentType) |
protected void |
defaultJsonContentType(io.netty.handler.codec.http.HttpHeaders headers) |
T |
header(java.lang.CharSequence name, java.lang.Object value) Sets a request header |
T |
json(groovy.lang.Closure callable) Adds JSON to the body of the request |
T |
json(java.util.List array) Adds JSON to the body of the request |
T |
json(java.util.Map json) Adds JSON to the body of the request |
T |
json(java.lang.String json) Adds JSON to the body of the request |
protected groovy.json.StreamingJsonBuilder |
prepareJsonBuilder() |
T |
xml(java.lang.String xml) Sets the body of the request to the XML string argument. |
T |
xml(groovy.lang.Closure closure) Sets the body of the request to the XML defined by the closure. |
T |
xml(groovy.util.slurpersupport.GPathResult xml) Sets the body of the request to the XML GPathResult argument. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The writer for the request body
Sets the content type for the request
contentType
- The content typeSets a request header
name
- The name of the headervalue
- The value of the headerAdds JSON to the body of the request
callable
- The callable that defines the JSONAdds JSON to the body of the request
array
- The JSON arrayAdds JSON to the body of the request
json
- The JSON as a mapAdds JSON to the body of the request
json
- The JSON as a mapSets the body of the request to the XML string argument.
xml
- The XML to be used as the body of the requestSets the body of the request to the XML defined by the closure. Uses groovy.xml.StreamingMarkupBuilder to produce the XML
closure
- The closure that defines the XMLSets the body of the request to the XML GPathResult argument.
xml
- The XML to be used as the body of the request