KickJava   Java API By Example, From Geeks To Geeks.

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


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
17 import javax.servlet.http.HttpSession JavaDoc;
18
19 /**
20  * provides access to the dispatcher and next view
21  */

22 public abstract class Controller implements RequestListener {
23   private static final Controller NULL_CONTROLLER = new Controller() {
24     public void addRequestListener(RequestListener l) {
25     }
26
27     public String JavaDoc getNextView() {
28       return null;
29     }
30
31     public List JavaDoc getRootListeners() {
32       return null;
33     }
34
35     public void removeRequestListener(RequestListener l) {
36     }
37
38     public void setNextView(String JavaDoc uri) {
39     }
40
41     public void request(RequestContext context) throws Exception JavaDoc {
42     }
43   };
44   public static Controller instance(HttpSession JavaDoc session) {
45     try {
46       return WcfController.instance(session);
47     } catch (IllegalStateException JavaDoc e) {
48       // session already invalidated
49
return NULL_CONTROLLER;
50       
51     }
52   }
53   
54   public abstract void addRequestListener(RequestListener l);
55   public abstract void removeRequestListener(RequestListener l);
56   public abstract void setNextView(String JavaDoc uri);
57   public abstract String JavaDoc getNextView();
58
59   /**
60    * returns all registered RequestListeners
61    */

62   public abstract List JavaDoc getRootListeners();
63 }
64
Popular Tags