com.worklight.wlclient.api
Class WLResponse
- java.lang.Object
-
- com.worklight.wlclient.api.WLResponse
-
- Direct Known Subclasses:
- WLFailResponse, WLProcedureInvocationResult
public class WLResponse extends java.lang.Object
This class contains the result of a procedure invocation.
-
-
Field Summary
Fields Modifier and Type Field and Description protected java.lang.String
statusText
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getFirstHeader(java.lang.String headerName)
Returns the first header from the response that matches the given header name.java.util.Map
getHeaders()
java.lang.Object
getInvocationContext()
Retrieves the invocation context object that is passed when theWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
method is called.byte[]
getResponseBytes()
Retrieves the original response from the server, in the form of an array of bytes.JSONObject
getResponseJSON()
java.lang.String
getResponseText()
Retrieves the original response text from the server.int
getStatus()
Retrieves the HTTP status from the response.java.lang.String
getStatusText()
protected void
setResponseJSON(JSONObject responseJSON)
void
setStatusText(java.lang.String statusText)
java.lang.String
toString()
-
-
-
Method Detail
-
getStatus
public int getStatus()
Retrieves the HTTP status from the response.
-
getInvocationContext
public java.lang.Object getInvocationContext()
Retrieves the invocation context object that is passed when theWLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener)
method is called.If this response did not originate from a procedure invocation, null is returned.
-
getResponseBytes
public byte[] getResponseBytes()
Retrieves the original response from the server, in the form of an array of bytes.
-
getResponseText
public java.lang.String getResponseText()
Retrieves the original response text from the server.
-
getHeaders
public java.util.Map getHeaders()
- Returns:
- An array of Headers
-
getFirstHeader
public java.lang.String getFirstHeader(java.lang.String headerName)
Returns the first header from the response that matches the given header name.- Parameters:
headerName
- Name of header to search for- Returns:
- First header with the given name, or null if no such headers exist.
-
getResponseJSON
public JSONObject getResponseJSON()
- Returns:
- JSON object obtained from response text.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setResponseJSON
protected void setResponseJSON(JSONObject responseJSON)
-
getStatusText
public java.lang.String getStatusText()
-
setStatusText
public void setStatusText(java.lang.String statusText)
-
-