コード例 #1
0
    private void instantiateInprocessWebServer() {
      httpServer = new HttpAppTester(contextPath);

      if (servletClass != null) {
        httpServer.addServlet(servletClass, servletPath, initParams);
      }

      if (contextParams != null) {
        for (Map.Entry<String, String> parameterEntry : contextParams.entrySet()) {
          httpServer.setInitParameter(parameterEntry.getKey(), parameterEntry.getValue());
        }
      }

      if (eventListeners != null) {
        for (Class<? extends EventListener> eventListener : eventListeners) {
          try {
            httpServer.addEventListener(eventListener.newInstance());
          } catch (InstantiationException e) {
            throw new RuntimeException(e);
          } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
コード例 #2
0
 public void stop() {
   LOGGER.info("Stopping the Inprocess Web Container...");
   httpServer.stop();
 }