| org.jivesoftware.openfire.interceptor.PacketInterceptor
All known Subclasses: org.jivesoftware.openfire.plugin.InterpretedXMLPrinter, org.jivesoftware.openfire.interceptor.PacketCopier, org.jivesoftware.openfire.plugin.ContentFilterPlugin, org.jivesoftware.openfire.gateway.BaseTransport,
PacketInterceptor | public interface PacketInterceptor (Code) | | A packet interceptor encapsulates an action that is invoked on a packet immediately
before or after it was received by a SocketReader and also when the packet is about to
be sent in SocketConnection. These types of actions fall into two broad categories:
- Interceptors that reject the packet by throwing an exception (only when the packet
has not been processed yet).
- Interceptors that dynamically transform the packet content.
Any number of interceptors can be installed and removed at run-time. They can be installed
globally or per-user. Global interceptors are run first, followed by any that are installed
for the username.
See Also: InterceptorManager author: Gaston Dombiak |
Method Summary | |
void | interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) Invokes the interceptor on the specified packet. |
interceptPacket | void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) throws PacketRejectedException(Code) | | Invokes the interceptor on the specified packet. The interceptor can either modify
the packet, or throw a PacketRejectedException to block it from being sent or processed
(when read).
An exception can only be thrown when processed is false which means that the read
packet has not been processed yet or the packet was not sent yet. If the exception is thrown
with a "read" packet then the sender of the packet will receive an answer with an error. But
if the exception is thrown with a "sent" packet then nothing will happen.
Note that for each packet, every interceptor will be called twice: once before processing
is complete (processing==true) and once after processing is complete. Typically,
an interceptor will want to ignore one or the other case.
Parameters: packet - the packet to take action on. Parameters: session - the session that received or is sending the packet. Parameters: incoming - flag that indicates if the packet was read by the server or sent fromthe server. Parameters: processed - flag that indicates if the action (read/send) was performed. (PRE vs. POST). throws: PacketRejectedException - if the packet should be prevented from being processed. |
|
|