def http = HttpBuilder.configure {
request.uri = "${serverRule.serverUrl}/jackson"
request.contentType = JSON[0]
Jackson.mapper(delegate, objectMapper)
}
public class Jackson
extends java.lang.Object
Parser and Encoder methods for handling JSON content using the Jackson JSON library.
Constructor and Description |
---|
Jackson() |
Modifier and Type | Method and Description |
---|---|
static void |
encode(ChainedHttpConfig config,
ToServer ts)
Used to encode the request content using the Jackson JSON encoder.
|
static void |
mapper(HttpConfig config,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Used to configure the provided Jackson
ObjectMapper in the configuration context for the default JSON content type. |
static void |
mapper(HttpConfig config,
com.fasterxml.jackson.databind.ObjectMapper mapper,
java.lang.Iterable<java.lang.String> contentTypes)
Used to configure the provided Jackson
ObjectMapper in the configuration context for the specified content type. |
static java.lang.Object |
parse(ChainedHttpConfig config,
FromServer fromServer)
Used to parse the server response content using the Jackson JSON parser.
|
static void |
use(HttpConfig config)
Configures the client to use the Jackson encoder/decoder for JSON handling, with the default JSON content type.
|
static void |
use(HttpConfig config,
java.lang.Iterable<java.lang.String> contentTypes)
Configures the client to use the Jackson encoder/decoder for JSON handling, with the specified JSON content type.
|
public static java.lang.Object parse(ChainedHttpConfig config, FromServer fromServer)
Used to parse the server response content using the Jackson JSON parser.
config
- the configurationfromServer
- the server content accessorpublic static void encode(ChainedHttpConfig config, ToServer ts)
Used to encode the request content using the Jackson JSON encoder.
config
- the configurationts
- the server request content accessorpublic static void mapper(HttpConfig config, com.fasterxml.jackson.databind.ObjectMapper mapper)
Used to configure the provided Jackson ObjectMapper
in the configuration context for the default JSON content type.
def http = HttpBuilder.configure {
request.uri = "${serverRule.serverUrl}/jackson"
request.contentType = JSON[0]
Jackson.mapper(delegate, objectMapper)
}
config
- the configurationmapper
- the ObjectMapper
to be used.public static void mapper(HttpConfig config, com.fasterxml.jackson.databind.ObjectMapper mapper, java.lang.Iterable<java.lang.String> contentTypes)
Used to configure the provided Jackson ObjectMapper
in the configuration context for the specified content type.
def http = HttpBuilder.configure {
request.uri = "${serverRule.serverUrl}/jackson"
request.contentType = OTHER_TYPE
Jackson.mapper(delegate, objectMapper, [OTHER_TYPE])
}
config
- the configurationmapper
- the ObjectMapper
to be used.contentTypes
- the content types to be configured with the mapperpublic static void use(HttpConfig config)
Configures the client to use the Jackson encoder/decoder for JSON handling, with the default JSON content type.
config
- the configurationpublic static void use(HttpConfig config, java.lang.Iterable<java.lang.String> contentTypes)
Configures the client to use the Jackson encoder/decoder for JSON handling, with the specified JSON content type.
def result = http.get {
Jackson.use(delegate)
}
config
- the configurationcontentTypes
- the content types to be configured