01: /*
02: * Copyright (C) 2004 TiongHiang Lee
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * Email: thlee@onemindsoft.org
19: */
20:
21: package org.onemind.swingweb.servlet;
22:
23: import java.awt.Window;
24: import java.io.IOException;
25: import java.io.Writer;
26: import java.util.logging.Logger;
27: import javax.servlet.http.*;
28: import org.onemind.awtbridge.session.SessionLifecycleListener;
29: import org.onemind.commons.java.lang.reflect.ReflectUtils;
30: import org.onemind.swingweb.SwingWebComponentManager;
31: import org.onemind.swingweb.SwingWebContext;
32: import org.onemind.swingweb.session.SwingWebSession;
33:
34: /**
35: * A Servlet for initializing the swingweb application. There's only two parameter needed
36: * for the application: <br>
37: * <ul>
38: * <li>app-class - the application class </li>
39: * <li>swingweb-config - the swing web configuration </li>
40: * </ul>
41: *
42: * @author TiongHiang Lee (thlee@onemindsoft.org)
43: *
44: */
45: public class SwingWebThinClientServlet extends AbstractSwingWebServlet {
46:
47: /** the logger * */
48: private static final Logger _logger = Logger
49: .getLogger(SwingWebThinClientServlet.class.getName());
50:
51: public SwingWebSession createSession(SwingWebContext context,
52: HttpSession session) {
53: return new SwingWebSession(new SwingWebComponentManager());
54: }
55:
56: /**
57: * {@inheritDoc}
58: */
59: protected void startApp(SwingWebSession swSession,
60: HttpServletRequest req, HttpServletResponse resp)
61: throws Exception {
62: Window w = getManager().startApp(
63: ReflectUtils.getClass(getAppClass()), null);
64: if (w instanceof SessionLifecycleListener) {
65: swSession.addListener((SessionLifecycleListener) w);
66: }
67: }
68: }
|