public class TwilioRestResponse extends Object
Constructor and Description |
---|
TwilioRestResponse(String url,
String text,
int status)
Instantiates a new twilio rest response.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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()
Copyright © 2011 Twilio, Inc. All Rights Reserved.