HTTP handler exit
The HTTP handler provides an exit that can be used to intercept and modify the request
and response. To register a scripted exit for the HTTP endpoint, the HTTPEXIT property of the
handler endpoint can be set to a value such as
script:script_name
.
The following set of callback functions are supported for scripts.
Script HTTP handler exit method | Purpose |
---|---|
urlProps(req) | Used for adding query parameters to a configured URL. The req object is
implemented by psdi.iface.router.ScriptHTTPReq . Use the
req.addUrlProp(propname,propvalue) API to set the URL query parameters. |
getUrl(req) | Used for setting the URL for an HTTP call. Use the req.setUrl(url) API to set the new URL. |
headerProps(req) | Used for setting request headers for the HTTP call. Use the req.addHeader(propname,propvalue) API to set the HTTP request headers. |
processResponse(resp) | Used for processing HTTP response. The resp object is implemented by
psdi.iface.router.ScriptHTTPResp . Use the resp.setError(java.util.Exception) API to
mark the response for error and the error message. You can use resp.getData() to get the response
data and analyze it in the script. |