/** 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);
    }
  }
Beispiel #2
0
 public static String parserNameFromConfiguration(
     final Class<?> type, final IsisConfiguration configuration) {
   final String key = PARSER_NAME_KEY_PREFIX + type.getCanonicalName() + PARSER_NAME_KEY_SUFFIX;
   final String parserName = configuration.getString(key);
   return !Strings.isNullOrEmpty(parserName) ? parserName : null;
 }
 public static String lookupCharset(final IsisConfiguration configuration) {
   return configuration.getString(ENCODING_PROPERTY, DEFAULT_ENCODING);
 }