public final class JsonRequest extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JsonRequest.Action
Defines the supported action types for all requests to the service
|
Modifier and Type | Method and Description |
---|---|
JsonRequest.Action |
getAction() |
String |
getBaseUrl() |
String |
getHash() |
String |
getResource() |
String |
getTargetUrl()
Return's the target URL this request was sent to; is null until the request is actually submitted
|
String |
getUserAgent() |
InputStream |
submitForInputStream(Object reqData)
Submit this request; returns the raw input stream of the content; caller responsible for closing stream when done.
|
InputStream |
submitForInputStream(Object reqData,
boolean failOnStatusError)
Submit this request; returns the raw input stream of the content; caller responsible for closing stream when done.
|
String |
submitForJson(Object reqData)
Submit this request; returns the JSON object response received; only call if the request is expected to return a JSON object in response
|
String |
submitForJson(Object reqData,
boolean ignoreContentType)
Submit this request; returns the JSON object response received; only call if the request is expected to return a JSON object in response
|
public String getTargetUrl()
public String submitForJson(Object reqData, boolean ignoreContentType) throws IOException
reqData
- The supporting data for the request; this is dependent on the action and obj target specifiedignoreContentType
- When true, the content type of the response is ignored (handles buggy SD server response for some request types)IOException
- Thrown on any IO error encounteredpublic String submitForJson(Object reqData) throws IOException
reqData
- The supporting data for the request; this is dependent on the action and obj target specifiedIOException
- Thrown on any IO error encounteredpublic InputStream submitForInputStream(Object reqData) throws IOException
reqData
- The supporting data for the request; this is dependent on the action and obj target specifiedIOException
- Thrown on any IO error encounteredIllegalStateException
- Thrown if called on a partially constructed object (the 2 arg ctor)public InputStream submitForInputStream(Object reqData, boolean failOnStatusError) throws IOException
reqData
- The supporting data for the request; this is dependent on the action and obj target specifiedfailOnStatusError
- If true and the status code of the HTTP request > 399 then throw an exception; if false just return the entity stream regardlessIOException
- Thrown on any IO error encounteredIllegalStateException
- Thrown if called on a partially constructed object (the 2 arg ctor)public String getBaseUrl()
public String getHash()
public String getUserAgent()
public String getResource()
public JsonRequest.Action getAction()
Copyright © 2012–2014 Battams, Derek. All rights reserved.