public class ProxyListenerScript extends Object implements ProxyListener
Modifier and Type | Field and Description |
---|---|
static int |
PROXY_LISTENER_ORDER |
Constructor and Description |
---|
ProxyListenerScript(ExtensionScript extension) |
Modifier and Type | Method and Description |
---|---|
int |
getArrangeableListenerOrder()
Gets the order of when this listener should be notified.
|
boolean |
onHttpRequestSend(HttpMessage msg)
Notifies the listener that a new request was received from the client and
is ready to be forwarded to the server.
|
boolean |
onHttpResponseReceive(HttpMessage msg)
Notifies the listener that a new response was received from the server
and is ready to be forwarded to the client.
|
public static final int PROXY_LISTENER_ORDER
public ProxyListenerScript(ExtensionScript extension)
public int getArrangeableListenerOrder()
ArrangeableProxyListener
The listeners are ordered in a natural order, the greater the order the later it will be notified.
Note: If two or more listeners have the same order, the order that those listeners will be notified is undefined.
getArrangeableListenerOrder
in interface ArrangeableProxyListener
int
with the value of the order that this listener
should be notified aboutpublic boolean onHttpRequestSend(HttpMessage msg)
ProxyListener
The HttpMessage
msg
can be modified (only the request
should be modified). If the return value is true
the message
may be forwarded and the following listeners will be notified, if
the value is false
the message will not be forwarded and
no more listeners will be notified.
Note: In the presence of more than one listener there are no guarantees that:
HttpMessage
msg
is equal to the one forwarded to
the server, as the following listeners may modify it;true
, as the following listeners may return
false
.onHttpRequestSend
in interface ProxyListener
msg
- the HttpMessage
that may be forwarded to the servertrue
if the message should be forwarded to the server,
false
otherwisepublic boolean onHttpResponseReceive(HttpMessage msg)
ProxyListener
The HttpMessage
msg
can be modified (only the response
should be modified). If the return value is true
the message
may be forwarded and the following listeners will be notified, if
the value is false
the message will not be forwarded and
no more listeners will be notified.
Note: In the presence of more than one listener there are no guarantees that:
HttpMessage
msg
is equal to the one forwarded to
the client, as the following listeners may modify it;true
, as the following listeners may return
false
.onHttpResponseReceive
in interface ProxyListener
msg
- the HttpMessage
that may be forwarded to the clienttrue
if the message should be forwarded to the client,
false
otherwise