public interface ProxyScript
Note: In the presence of more than one script or listener (for example,
ProxyListener
and HttpSenderListener
) there are no guarantees
that the (final) request/response is exactly the same as the one crafted by this script, or, that
the request/response is actually going to be forwarded, as the following scripts/listeners may
modify it or drop it.
Modifier and Type | Method and Description |
---|---|
boolean |
proxyRequest(HttpMessage msg)
Called when a request is received from the client.
|
boolean |
proxyResponse(HttpMessage msg)
Called after receiving the response from a proxied request.
|
boolean proxyRequest(HttpMessage msg) throws ScriptException
Both the request and response of the HTTP message may be modified. If a response is set
the request is not forwarded to the server, thus preventing the request and overriding
the response. If the return value is true
the request may be forwarded and the
following scripts/listeners will be called, if the value is false
the request is
dropped and no more scripts/listeners will be called.
msg
- the HTTP message (request) being proxied/sent.true
if the request should be forwarded to the server, false
otherwise.ScriptException
- if an error occurred while executing the script.boolean proxyResponse(HttpMessage msg) throws ScriptException
If the return value is true
the response may be forwarded and the following
scripts/listeners will be called, if the value is false
the response will not
be forwarded and no more scripts/listeners will be called.
msg
- the HTTP message (response) received (or overridden by a script/listener).true
if the response should be forwarded to the client, false
otherwise.ScriptException
- if an error occurred while executing the script.