public class JSONRequest extends Request<JSONRequest>
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
dataMap |
protected com.fasterxml.jackson.databind.ObjectMapper |
MAPPER |
_this, channel, conf, connectFuture, contents, cookies, future, group, method, originalUri, policy, proxyHost, proxyPass, proxyPort, proxyRequest, proxyUser, queryParams, redirectStatusCodes, request, response, sslProtocols, tunneling, uri, userAgent, useSSL, UTF8, version| Constructor and Description |
|---|
JSONRequest(HttpRequestBuilder builder,
io.netty.channel.EventLoopGroup group,
URI uri,
io.netty.handler.codec.http.HttpVersion version,
Reader f,
io.netty.handler.codec.http.HttpMethod method) |
| Modifier and Type | Method and Description |
|---|---|
JSONRequest |
addField(String name,
Object value)
Adds a field to the JSON payload that will be sent as the request body
The resulting payload will have all keys added with this method pointed to each value
|
FutureResponse |
execute(Function1<io.netty.bootstrap.Bootstrap> conf)
Makes the request to the server
|
com.fasterxml.jackson.databind.ObjectMapper |
mapper() |
JSONRequest |
setData(Object data)
Sets the content of the request.
|
JSONRequest |
setData(String data)
Sets the content of the request.
|
baseDirectory, configure, configureProxy, connect, cookie, cookie, cookies, deleteTempFileOnExit, execute, getChannel, getHost, getPort, getProxyPath, getScheme, header, header, header, headers, isProxyEnabled, isSSLScheme, makeTheRequest, nettyRequest, newHandler, newInitializer, newNettyRequest, originalUri, policy, proxy, proxy, query, redirectOn, redirectOn, response, retry, retryOn, retryOn, retryOrFail, shutdown, url, url, userAgent, withSSLProtocolspublic JSONRequest(HttpRequestBuilder builder, io.netty.channel.EventLoopGroup group, URI uri, io.netty.handler.codec.http.HttpVersion version, Reader f, io.netty.handler.codec.http.HttpMethod method)
public FutureResponse execute(Function1<io.netty.bootstrap.Bootstrap> conf)
Requestexecute in class Request<JSONRequest>IllegalStateException - if Jackson is unable to serialize the data added using
addField(String, Object)public JSONRequest addField(String name, Object value)
name - the name of the fieldvalue - the value the field should haveIllegalStateException - if setData(Object) has been used to set the data field on
this requestpublic JSONRequest setData(String data)
data - the data to send in the request. If the type is aIllegalStateException - if addField(String, Object) has been used to add any fieldspublic JSONRequest setData(Object data) throws com.fasterxml.jackson.core.JsonProcessingException
data - the data to send in the request. If the type is aIllegalStateException - if addField(String, Object) has been used to add any fieldscom.fasterxml.jackson.core.JsonProcessingExceptionpublic com.fasterxml.jackson.databind.ObjectMapper mapper()
Copyright © 2012-2015. All Rights Reserved.