Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tonbeller.wcf.controller
Class DispatcherSupport

    java.lang.Object
      com.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.

- If a listener is registered with name and value, it receives the event if the request contains a paramter with that name and value.
- If a listener is registered with name only, it receives the event if the request contains a parameter with that name and any value.
- If a listener is registered with value only, it receives the event if the request contains a parameter with that value and any name.
- If a listener is registered with no name and no value, it receives every request.

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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD