KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > controller > Dispatcher


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.controller;
14
15 import java.util.List JavaDoc;
16 import java.util.Map JavaDoc;
17
18 /**
19  * Fires events to listeners depending on parameters in the HttpServletRequest.
20  * <ul>
21  * <li>If a listener is registered with name <em>and</em> value, it receives the event
22  * if the request contains a paramter with that name and value.
23  * <li>If a listener is registered with name only, it receives the event if the request
24  * contains a parameter with that name and any value.
25  * <li>If a listener is registered with value only, it receives the event if the request
26  * contains a parameter with that value and any name.
27  * <li>If a listener is registered with no name and no value, it receives every request.
28  * </ul>
29  */

30 public interface Dispatcher extends RequestListener {
31
32   /**
33    * Adds a listener. A listener can only be registered once.
34    * If its registered more than once, the last name/value
35    * pair will be used.
36    *
37    * @param name name of the request parameter or null
38    * @param value of the request parameter or null
39    * @param listener the listener to register
40    */

41   void addRequestListener(String JavaDoc name, String JavaDoc value, RequestListener listener);
42
43   /**
44    * removes a listener.
45    * @param listener the listener to remove
46    */

47   void removeRequestListener(RequestListener listener);
48
49   /**
50    * removes all listeners
51    */

52   void clear();
53
54   /**
55    * fires an event to all matching RequestListeners
56    * @param context the current request
57    * @throws Exception the exception from listeners
58    */

59   void request(RequestContext context) throws Exception JavaDoc;
60
61   /**
62    * returns the list of leaf RequestListeners that would be
63    * invoked for a request with the given parameters.
64    */

65   List JavaDoc findMatchingListeners(Map JavaDoc httpParams);
66   
67 }
Popular Tags