public class JSONCall extends Object
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
String value)
Adds a custom header field to the call
|
com.alibaba.fastjson.JSONObject |
getInput()
Provides access to the JSON answer of the call.
|
JSONStructuredOutput |
getOutput()
Can be used to generate the JSON request.
|
void |
getPlainInput()
Returns the response of the call as plain text.
|
static JSONCall |
to(URL url)
Creates a new JSONCall for the given url with Content-Type 'application/json'.
|
static JSONCall |
to(URL url,
String contentType)
Creates a new JSONCall for the given url.
|
public static JSONCall to(URL url) throws IOException
url
- the target URL to callIOException
- in case of an IO errorpublic static JSONCall to(URL url, String contentType) throws IOException
url
- the target URL to callcontentType
- the Content-Type to useIOException
- in case of an IO errorpublic void addHeader(String name, String value)
name
- name of the fieldvalue
- value of the fieldpublic JSONStructuredOutput getOutput() throws IOException
IOException
- in case of an IO error while sending the JSON documentpublic com.alibaba.fastjson.JSONObject getInput() throws IOException
IOException
- in case of an IO error while receiving the resultpublic void getPlainInput() throws IOException
IOException
- in case of an IO error while receiving the resultCopyright © 2018. All rights reserved.