private IsisConfigurationBuilder createConfigBuilder(ServletContext servletContext) {
   final ResourceStreamSource rssServletContext =
       new ResourceStreamSourceForWebInf(getServletContext());
   final ResourceStreamSource rssTcl = ResourceStreamSourceContextLoaderClassPath.create();
   final ResourceStreamSource rssClasspath = new ResourceStreamSourceCurrentClassClassPath();
   final IsisConfigurationBuilder isisConfigurationBuilder =
       new IsisConfigurationBuilderResourceStreams(rssTcl, rssClasspath, rssServletContext);
   primeConfigurationBuilder(isisConfigurationBuilder, servletContext);
   isisConfigurationBuilder.addDefaultConfigurationResources();
   return isisConfigurationBuilder;
 }
 @Override
 public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
   if (startupMode != null) {
     isisConfigurationBuilder.add(
         WebServerConstants.EMBEDDED_WEB_SERVER_STARTUP_MODE_KEY, startupMode.name());
   }
 }
Ejemplo n.º 3
0
  /** ignores the arguments and just bootstraps JettyViewer, come what may. */
  @Override
  public void bootstrap(final Injector injector) {

    final IsisConfigurationBuilder isisConfigurationBuilder = runner.getStartupConfiguration();

    // we don't actually bootstrap the system here; instead we expect it to
    // be bootstrapped
    // from the ServletContextInitializer in the web.xml
    final IsisConfiguration configuration = isisConfigurationBuilder.getConfiguration();
    final int port =
        configuration.getInteger(EMBEDDED_WEB_SERVER_PORT_KEY, EMBEDDED_WEB_SERVER_PORT_DEFAULT);
    final String webappContextPath =
        configuration.getString(
            EMBEDDED_WEB_SERVER_RESOURCE_BASE_KEY, EMBEDDED_WEB_SERVER_RESOURCE_BASE_DEFAULT);
    final StartupMode startupMode =
        StartupMode.lookup(
            configuration.getString(
                EMBEDDED_WEB_SERVER_STARTUP_MODE_KEY, EMBEDDED_WEB_SERVER_STARTUP_MODE_DEFAULT));
    // TODO get and use the address

    jettyServer = new Server(port);
    Connector[] connectors = jettyServer.getConnectors();
    Connector connector = connectors[0];
    connector.setHeaderBufferSize(8192);
    final WebAppContext context = new WebAppContext(SRC_MAIN_WEBAPP, webappContextPath);

    copyConfigurationPrimersIntoServletContext(context);

    jettyServer.setHandler(context);

    LOG.info("starting Jetty on port " + port + " to serve webapp");
    try {
      jettyServer.start();
      if (startupMode.isForeground()) {
        jettyServer.join();
      }
    } catch (final Exception ex) {
      throw new IsisException("Unable to start Jetty server", ex);
    }
  }
 @Override
 public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
   isisConfigurationBuilder.add(SystemConstants.USER_KEY, userName);
 }