|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmarquee.xmlrpc.processors.FilterInvocationProcessor
public class FilterInvocationProcessor
A sample processor that allows invocations to be filtered out based on the IP address of the caller and, optionally, a handler. The example may be extended to support filtering on a single method of a handler. The code is somewhat lengthy, as are all examples. This could be used in production code, but should be tested thoroughly first.
Constructor Summary | |
---|---|
FilterInvocationProcessor()
|
Method Summary | |
---|---|
void |
addFilters(java.lang.String handler,
java.util.List filterList)
Adds a filter to the processor, comprising of an optional handler name and a list of IP masks. |
void |
addFiltersByName(java.lang.String handler,
java.util.List filterList)
Adds a filter to the processor, comprising of an optional handler name and a list of IP masks. |
void |
onException(int callId,
java.lang.String callerIp,
java.lang.String handler,
java.lang.String method,
java.util.List arguments,
java.lang.Throwable exception)
Does nothing. |
java.lang.Object |
postProcess(int callId,
java.lang.String callerIp,
java.lang.String handler,
java.lang.String method,
java.util.List arguments,
java.lang.Object returnValue)
Does nothing. |
boolean |
preProcess(int callId,
java.lang.String callerIp,
java.lang.String handler,
java.lang.String method,
java.util.List arguments)
Examines the caller IP and the method to see if the invocation should be performed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilterInvocationProcessor()
Method Detail |
---|
public final void addFilters(java.lang.String handler, java.util.List filterList)
Note! This method takes the ownership of the supplied filter List. That is, the supplied List should not be used after calling this method.
handler
- The handler to which the filter should apply, or null, if the filters should
apply to all handlers.filterList
- A list of strings containing IP addresses with or without wildcards.
For instance, 192.168.*.* is a valid filter entry.public void addFiltersByName(java.lang.String handler, java.util.List filterList) throws java.lang.IllegalArgumentException, java.net.UnknownHostException
Note! This method takes the ownership of the supplied filter List. That is, the supplied List should not be used after calling this method.
filterList
- A list of strings containing IP addresses with or without wildcards.
For instance, 192.168.*.* is a valid filter entry.
java.lang.IllegalArgumentException
java.net.UnknownHostException
public boolean preProcess(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments)
preProcess
in interface XmlRpcInvocationProcessor
callId
- A sequence number for tracing calls between preProcess() and
postProcess() calls. This is unique within each session. That is,
the sequence is restarted when the application restarts.handler
- The name of the handler being called.method
- The name of the method being called.arguments
- The arguments that will be sent to the method.
public java.lang.Object postProcess(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments, java.lang.Object returnValue)
postProcess
in interface XmlRpcInvocationProcessor
callId
- A sequence number for tracing calls between preProcess() and
postProcess() calls. This is unique within each session. That is,
the sequence is restarted when the application restarts.handler
- The name of the handler being called.method
- The name of the method that just has returned.returnValue
- The objects returned by the method. If the method
returned a primitive, it is wrapped in its object counterpart.
public void onException(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments, java.lang.Throwable exception)
onException
in interface XmlRpcInvocationProcessor
callId
- A sequence number for tracing calls between preProcess() and
postProcess() calls. This is unique within each session. That is,
the sequence is restarted when the application restarts.handler
- The name of the handler being called.method
- The name of the method that just has returned by throwing an
exception.exception
- The exception thrown by the method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |