Class JythonResponse

java.lang.Object
com.xebialabs.xlplatform.endpoints.JythonResponse

public class JythonResponse extends Object
Response object which is always available as 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 Details

    • JythonResponse

      public JythonResponse()
  • Method Details

    • getEntity

      public Object getEntity()
    • getStatusCode

      public Integer getStatusCode()
    • getHeaders

      public Map<String,String> getHeaders()
    • setEntity

      public void setEntity(Object entity)
      Sets body of the response which will be serialized into JSON and returned to the client. response.entity=[{"foo": 42, "bar": "some value"}, 34] Supported types are:
      • Standard JSON data types: Number, String, Boolean, Array*, Dictionary*
      • XL configuration items: ConfigurationItem
      * Array and Dictionary can recursively contain aforementioned types as values of their elements.
    • setStatusCode

      public void setStatusCode(Integer statusCode)
      Sets an HTTP status code for the response. Normally this HTTP status code will be returned to the client. E.g.: 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.
    • setHeaders

      public void setHeaders(Map<String,String> headers)
      Sets response headers. E.g.: response.headers = {'Location': 'http://google.com'}