Package com.google.opengse.webapp

Examples of com.google.opengse.webapp.WebAppConfigurationBuilder


  private static ServletEngine engine;

  @BeforeClass
  public static void startEngine() throws Exception {
    WebAppConfigurationBuilder configBuilder = new WebAppConfigurationBuilder();

    configBuilder.addServlet(BasicServlet.class, "/bar1/wildcard");
    configBuilder.addFilter(BasicFilter.class, "/bar1/*");

    configBuilder.addServlet(BasicServlet.class, "/bar2/exact");
    configBuilder.addFilter(BasicFilter.class, "/bar2/exact");

    configBuilder.addServlet(BasicServlet.class, "/bar3/wildcard/*");
    configBuilder.addFilter(BasicFilter.class, "/bar3/*");

    Properties props = new Properties();
    props.setProperty("context", "foo");
    props.setProperty("contextdir", "/tmp/opengse");
    props.setProperty("javax.servlet.context.tempdir", "/tmp/opengse");

    WebAppCollection webapps
        = WebAppCollectionFactory.createWebAppCollectionWithOneContext(props, configBuilder.getConfiguration());

    webapps.startAll();
    ServletEngineConfiguration config
        = ServletEngineConfigurationImpl.create(-1, 5);
    ServletEngineFactory engineFactory
View Full Code Here


  private static ServletEngine engine;

  @BeforeClass
  public static void startEngine() throws Exception {
    WebAppConfigurationBuilder configBuilder = new WebAppConfigurationBuilder();

    configBuilder.addServlet(BasicServlet.class, "/bar/*");

    Properties props = new Properties();
    props.setProperty("context", "foo");
    props.setProperty("contextdir", "/tmp/opengse");
    props.setProperty("javax.servlet.context.tempdir", "/tmp/opengse");

    WebAppCollection webapps
        = WebAppCollectionFactory.createWebAppCollectionWithOneContext(props, configBuilder.getConfiguration());

    webapps.startAll();
    ServletEngineConfiguration config
        = ServletEngineConfigurationImpl.create(-1, 5);
    ServletEngineFactory engineFactory
View Full Code Here

  private static final int PORT = 8080;
  private static final int MAX_THREADS = 5;

  public static void main(String[] args) throws Exception {
    // This object will create our webapp's configuration for us
    WebAppConfigurationBuilder configBuilder = new WebAppConfigurationBuilder();
    // register our servlet to respond to the "/bar" pattern
    configBuilder.addFilter(GuiceFilter.class, "/*");
    configBuilder.addServlet(BasicServlet.class, "/bar");
    // we need to be able to return a directory
    // when javax.servlet.ServletContext.getRealPath("/") is called
    // hence the need for a context directory
    File contextDir = new File(System.getProperty("java.io.tmpdir"));
    // We want "" to be returned by
    // javax.servlet.http.HttpServletRequest.getContextPath() (ie. the root context)
    // so we use the "ROOT" context name (this is so we can have files called ROOT.war and not
    // "".war
    String context = "ROOT";
    // create a collection of webapps that just contains a single webapp
    WebAppCollection webapps
      = WebAppCollectionFactory.createWebAppCollectionWithOneContext(contextDir,
        context, configBuilder.getConfiguration());
    // start all of the webapps
    webapps.startAll();
    // create servlet engine configuration object
    ServletEngineConfiguration config
        = ServletEngineConfigurationImpl.create(PORT, MAX_THREADS);
View Full Code Here

      classdef.write(java);
    } finally {
      java.close();
    }
   
    WebAppConfigurationBuilder wxmlb = new WebAppConfigurationBuilder();
    wxmlb.addContextParam("global.foo1", "global.bar1");
    wxmlb.addContextParam("global.foo2", "global.bar2");
    wxmlb.unsafe_addServlet("myservlet", EXAMPLE_CODE_PACKAGE + "." + EXAMPLE_CODE_CLASS, "*.cgi", "chocolate", "good");
    File webxmlfile = new File(webinf, "web.xml");
    PrintWriter webxml = new PrintWriter(webxmlfile);
    try {
      WebXmlDump.dump(wxmlb.getConfiguration(), webxml);
    } finally {
      webxml.close();
    }
    System.err.println("Created '" + webxmlfile + "'");
    File propsfile = new File(parent, context + ".properties");
View Full Code Here

  private static final int PORT = 8080;
  private static final int MAX_THREADS = 5;

  public static void main(String[] args) throws Exception {
    // This object will create our webapp's configuration for us
    WebAppConfigurationBuilder configBuilder = new WebAppConfigurationBuilder();
    // register our servlet to respond to the "/bar" pattern
    configBuilder.addServlet(BasicServlet.class, "/bar");
    // we need to be able to return a directory
    // when javax.servlet.ServletContext.getRealPath("/") is called
    // hence the need for a context directory
    File contextDir = new File(System.getProperty("java.io.tmpdir"));
    // We want "" to be returned by
    // javax.servlet.http.HttpServletRequest.getContextPath() (ie. the root context)
    // so we use the "ROOT" context name (this is so we can have files called ROOT.war and not
    // .war
    String context = "ROOT";
    // create a collection of webapps that just contains a single webapp
    WebAppCollection webapps
      = WebAppCollectionFactory.createWebAppCollectionWithOneContext(contextDir,
        context, configBuilder.getConfiguration());
    // start all of the webapps
    webapps.startAll();
    // create servlet engine configuration object
    ServletEngineConfiguration config
        = ServletEngineConfigurationImpl.create(PORT, MAX_THREADS);
View Full Code Here

  private static final int PORT = 8080;
  private static final int MAX_THREADS = 5;

  public static void main(String[] args) throws Exception {
    // This object will create our webapp's configuration for us
    WebAppConfigurationBuilder configBuilder = new WebAppConfigurationBuilder();
    // register our servlet to respond to the "/bar" pattern
    configBuilder.addServlet(BasicServlet.class, "/bar");
    // we need to be able to return a directory
    // when javax.servlet.ServletContext.getRealPath("/") is called
    // hence the need for a context directory
    File contextDir = new File(System.getProperty("java.io.tmpdir"));
    // We want "/foo" to be returned by
    // javax.servlet.http.HttpServletRequest.getContextPath()
    String context = "foo";
    // create a collection of webapps that just contains a single webapp
    WebAppCollection webapps
      = WebAppCollectionFactory.createWebAppCollectionWithOneContext(contextDir,
        context, configBuilder.getConfiguration());
    // start all of the webapps
    webapps.startAll();
    // create servlet engine configuration object
    ServletEngineConfiguration config
        = ServletEngineConfigurationImpl.create(PORT, MAX_THREADS);
View Full Code Here

TOP

Related Classes of com.google.opengse.webapp.WebAppConfigurationBuilder

Copyright © 2018 www.massapicom. 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.