|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.twilio.sdk.TwilioRestResponse
public class TwilioRestResponse
TwilioRestResponse holds all the REST response data Before using the response, check IsError to see if an exception occurred with the data sent to Twilio ResponseText contains the raw string response Url and QueryString are from the request HttpStatus is the response code of the request.
Constructor Summary | |
---|---|
TwilioRestResponse(String url,
String text,
int status)
Instantiates a new twilio rest response. |
Method Summary | |
---|---|
int |
getHttpStatus()
Get the http status code associated with this response. |
ResponseParser |
getParser()
Get an appropriate response parser for this response type |
String |
getQueryString()
Get the query string that resulted in this response |
String |
getResponseText()
Get the raw response body as a String |
String |
getUrl()
Get the url that resulted in this response |
boolean |
isClientError()
Determines if the response was a client side error (HTTP 4XX status) |
boolean |
isError()
Determine if this request resulted in any kind of error |
boolean |
isJson()
Method to determine if the response content type was a JSON type |
boolean |
isServerError()
Determines if the response was a server side error (HTTP 5XX status) |
boolean |
isXml()
Method to determine if the response content type was an XML type |
void |
setContentType(String contentType)
Sets the content type. |
void |
setError(boolean error)
Sets the error. |
void |
setHttpStatus(int httpStatus)
Sets the http status. |
void |
setQueryString(String queryString)
Sets the query string. |
void |
setResponseText(String responseText)
Sets the response text. |
void |
setUrl(String url)
Sets the url. |
Map<String,Object> |
toMap()
Helper method to convert the response to a canonical object map. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TwilioRestResponse(String url, String text, int status)
url
- the urltext
- the textstatus
- the statusMethod Detail |
---|
public String getResponseText()
public void setResponseText(String responseText)
responseText
- the new response textpublic int getHttpStatus()
public void setHttpStatus(int httpStatus)
httpStatus
- the new http statuspublic String getUrl()
public void setUrl(String url)
url
- the new urlpublic String getQueryString()
public void setQueryString(String queryString)
queryString
- the new query stringpublic boolean isError()
public void setError(boolean error)
error
- the new errorpublic boolean isClientError()
public boolean isServerError()
public void setContentType(String contentType)
contentType
- the new content typepublic boolean isJson()
public boolean isXml()
public ResponseParser getParser()
public Map<String,Object> toMap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |