Package org.onemind.swingweb.servlet

Source Code of org.onemind.swingweb.servlet.SwingWebThinClientServlet

/*
* Copyright (C) 2004 TiongHiang Lee
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not,  write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* Email: thlee@onemindsoft.org
*/

package org.onemind.swingweb.servlet;

import java.awt.Window;
import java.io.IOException;
import java.io.Writer;
import java.util.logging.Logger;
import javax.servlet.http.*;
import org.onemind.awtbridge.session.SessionLifecycleListener;
import org.onemind.commons.java.lang.reflect.ReflectUtils;
import org.onemind.swingweb.SwingWebComponentManager;
import org.onemind.swingweb.SwingWebContext;
import org.onemind.swingweb.session.SwingWebSession;
/**
* A Servlet for initializing the swingweb application. There's only two parameter needed
* for the application: <br>
* <ul>
*     <li>app-class - the application class </li>
*     <li>swingweb-config - the swing web configuration </li>
* </ul>
*
* @author TiongHiang Lee (thlee@onemindsoft.org)
*
*/
public class SwingWebThinClientServlet extends AbstractSwingWebServlet
{

    /** the logger * */
    private static final Logger _logger = Logger.getLogger(SwingWebThinClientServlet.class.getName());

    public SwingWebSession createSession(SwingWebContext context, HttpSession session)
    {
        return new SwingWebSession(new SwingWebComponentManager());
    }

    /**
     * {@inheritDoc}
     */
    protected void startApp(SwingWebSession swSession, HttpServletRequest req, HttpServletResponse resp) throws Exception
    {
        Window w = getManager().startApp(ReflectUtils.getClass(getAppClass()), null);
        if (w instanceof SessionLifecycleListener)
        {
            swSession.addListener((SessionLifecycleListener) w);
        }
    }
}
TOP

Related Classes of org.onemind.swingweb.servlet.SwingWebThinClientServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.