com.tonbeller.wcf.controller
Class DispatcherSupport

java.lang.Object
  extended bycom.tonbeller.wcf.controller.DispatcherSupport
All Implemented Interfaces:
Dispatcher, RequestListener

public class DispatcherSupport
extends java.lang.Object
implements Dispatcher

Fires events to listeners depending on parameters in the HttpServletRequest.


Constructor Summary
DispatcherSupport()
           
 
Method Summary
 void addRequestListener(java.lang.String name, java.lang.String value, RequestListener listener)
          Adds a listener.
 void clear()
          removes all listeners
 java.util.List findMatchingListeners(java.util.Map httpParams)
          returns the leaf RequestListeners that would be invoked for a http request containing httpParams
 void removeRequestListener(RequestListener listener)
          removes a listener.
 void request(RequestContext context)
          fires event to all matching listeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatcherSupport

public DispatcherSupport()
Method Detail

addRequestListener

public void addRequestListener(java.lang.String name,
                               java.lang.String value,
                               RequestListener listener)
Adds a listener. A listener can only be registered once. If its registered more than one, the last name/value pair will be used.

Specified by:
addRequestListener in interface Dispatcher
Parameters:
name - name of the request parameter or null
value - of the request parameter or null
listener - the listener to register

removeRequestListener

public void removeRequestListener(RequestListener listener)
removes a listener.

Specified by:
removeRequestListener in interface Dispatcher
Parameters:
listener - the listener to remove

clear

public void clear()
removes all listeners

Specified by:
clear in interface Dispatcher

request

public void request(RequestContext context)
             throws java.lang.Exception
fires event to all matching listeners

Specified by:
request in interface Dispatcher
Parameters:
context - the current request
Throws:
java.lang.Exception - the exception from listeners

findMatchingListeners

public java.util.List findMatchingListeners(java.util.Map httpParams)
returns the leaf RequestListeners that would be invoked for a http request containing httpParams

Specified by:
findMatchingListeners in interface Dispatcher