public static class NativeHandlers.Encoders
extends java.lang.Object
The set of available content encoders.
Constructor and Description |
---|
Encoders() |
Modifier and Type | Method and Description |
---|---|
static void |
binary(ChainedHttpConfig config,
ToServer ts)
Standard encoder for binary types.
|
static java.lang.Object |
checkNull(java.lang.Object body) |
static void |
checkTypes(java.lang.Object body,
java.lang.Class<?>[] allowedTypes) |
static void |
form(ChainedHttpConfig config,
ToServer ts)
Standard encoder for requests with content type 'application/x-www-form-urlencoded'.
|
static boolean |
handleRawUpload(ChainedHttpConfig config,
ToServer ts) |
static void |
json(ChainedHttpConfig config,
ToServer ts)
Standard encoder for requests with a json body.
|
static java.io.InputStream |
readerToStream(java.io.Reader r,
java.nio.charset.Charset cs) |
static java.io.InputStream |
stringToStream(java.lang.String s,
java.nio.charset.Charset cs) |
static void |
text(ChainedHttpConfig config,
ToServer ts)
Standard encoder for text types.
|
static void |
xml(ChainedHttpConfig config,
ToServer ts)
Standard encoder for requests with an xml body.
|
public static java.lang.Object checkNull(java.lang.Object body)
public static void checkTypes(java.lang.Object body, java.lang.Class<?>[] allowedTypes)
public static java.io.InputStream readerToStream(java.io.Reader r, java.nio.charset.Charset cs) throws java.io.IOException
java.io.IOException
public static java.io.InputStream stringToStream(java.lang.String s, java.nio.charset.Charset cs)
public static boolean handleRawUpload(ChainedHttpConfig config, ToServer ts)
public static void binary(ChainedHttpConfig config, ToServer ts)
Standard encoder for binary types. Accepts ByteArrayInputStream, InputStream, and byte[] types.
config
- Fully configured chained requestts
- Formatted http body is passed to the ToServer argumentpublic static void text(ChainedHttpConfig config, ToServer ts) throws java.io.IOException
Standard encoder for text types. Accepts String and Reader types
config
- Fully configured chained requestts
- Formatted http body is passed to the ToServer argumentjava.io.IOException
public static void form(ChainedHttpConfig config, ToServer ts)
Standard encoder for requests with content type 'application/x-www-form-urlencoded'.
Accepts String and Map types. If the body is a String type the method assumes it is properly
url encoded and is passed to the ToServer parameter as is. If the body is a Map type then
the output is generated by the Form
class.
config
- Fully configured chained requestts
- Formatted http body is passed to the ToServer argumentpublic static void xml(ChainedHttpConfig config, ToServer ts)
Standard encoder for requests with an xml body.
<p>
Accepts String and Closure
types. If the body is a String type the method passes the body
to the ToServer parameter as is. If the body is a Closure
then the closure is converted
to xml using Groovy’s StreamingMarkupBuilder
.
config
- Fully configured chained requestts
- Formatted http body is passed to the ToServer argumentpublic static void json(ChainedHttpConfig config, ToServer ts)
Standard encoder for requests with a json body.
<p>
Accepts String, GString
and Closure
types. If the body is a String type the method passes the body
to the ToServer parameter as is. If the body is a Closure
then the closure is converted
to json using Groovy’s JsonBuilder
.
config
- Fully configured chained requestts
- Formatted http body is passed to the ToServer argument