public class JythonResponse
extends java.lang.Object
response
inside Jython scripts which implement REST endpoints in XL extensions.
The content of HTTP response returned to the client will be the following:
{
entity: "object, or array",
stdout: "Text which has been sent to standard output during the execution",
stderr: "Text which has been sent to standard error during the execution",
exception: "Textual representation of exception that has been thrown during script execution"
}
Constructor and Description |
---|
JythonResponse() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getEntity() |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
java.lang.Integer |
getStatusCode() |
void |
setEntity(java.lang.Object entity)
Sets body of the response which will be serialized into JSON and returned to the client.
|
void |
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets response headers.
|
void |
setStatusCode(java.lang.Integer statusCode)
Sets an HTTP status code for the response.
|
public java.lang.Object getEntity()
public java.lang.Integer getStatusCode()
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
public void setEntity(java.lang.Object entity)
response.entity=[{"foo": 42, "bar": "some value"}, 34]
Supported types are:
Number
, String
, Boolean
, Array*
, Dictionary*
Array
and Dictionary
can recursively contain aforementioned types as values of their elements.public void setStatusCode(java.lang.Integer statusCode)
response.statusCode = 307
.
If this value is not set and script has been executed successfully, client will receive 200
.
If script throws exception which is not caught, this value will be ignored and 500
will be returned.public void setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
response.headers = {'Location': 'http://google.com'}