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
Interface Dispatcher

All Superinterfaces:
  RequestListener

All Known Implementing Classes:
  DispatcherSupport

public interface Dispatcher
extends RequestListener

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.

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 list of leaf RequestListeners that would be invoked for a request with the given parameters.
`void` | `removeRequestListener(RequestListener listener)` removes a listener.
`void` | `request(RequestContext context)` fires an event to all matching RequestListeners

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 once, the last name/value pair will be used.

  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.

  Parameters:
    `listener` - the listener to remove

### clear

    public void clear()

  removes all listeners

### request

    public void request(RequestContext context)
                 throws java.lang.Exception

  fires an event to all matching RequestListeners

  Specified by:
    `request` in interface `RequestListener`
  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 list of leaf RequestListeners that would be invoked for a request with the given parameters.

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