Package net.ajiaojr.spadger.server

Source Code of net.ajiaojr.spadger.server.ServletConfig

/*
* Spadger - an open source discussion forum system.
*
* Copyright (C) 2011 The Spadger Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
*
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package net.ajiaojr.spadger.server;

import javax.inject.Singleton;

import net.ajiaojr.spadger.server.servlet.ForwardServlet;
import net.ajiaojr.spadger.server.servlet.LandingServlet;
import net.ajiaojr.spadger.server.servlet.LoginServlet;
import net.ajiaojr.spadger.server.servlet.LogoutServlet;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import com.google.web.bindery.requestfactory.server.RequestFactoryServlet;

/**
* @author The Spadger Team
*/
public class ServletConfig extends GuiceServletContextListener {

  /*
   * (non-Javadoc)
   *
   * @see com.google.inject.servlet.GuiceServletContextListener#getInjector()
   */
  @Override
  protected Injector getInjector() {
    return Guice.createInjector(new ServletModule() {

      @Override
      protected void configureServlets() {
        // install(new JpaPersistModule("transactions-optional"));
        // filter("/*").through(PersistFilter.class);

        // GWT request factory stuff
        bind(RequestFactoryServlet.class).in(Singleton.class);
        serve("/gwtRequest").with(RequestFactoryServlet.class);

        // URLs for logging in and out
        serve("/login.php").with(LoginServlet.class);
        serve("/logout.php").with(LogoutServlet.class);
        serve("/forward.php").with(ForwardServlet.class);

        serve("/index.jsp").with(LandingServlet.class);
      }
    });
  }

}
TOP

Related Classes of net.ajiaojr.spadger.server.ServletConfig

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.