Exemplo n.º 1
0
 @Override
 public ServletContext getContext(final String uripath) {
   DeploymentManager deploymentByPath = servletContainer.getDeploymentByPath(uripath);
   if (deploymentByPath == null) {
     return null;
   }
   return deploymentByPath.getDeployment().getServletContext();
 }
Exemplo n.º 2
0
  protected void deployServlet(final DeploymentInfo deploymentInfo) {
    DeploymentManager manager =
        ServletContainer.Factory.newInstance().addDeployment(deploymentInfo);

    manager.deploy();
    deployment = manager.getDeployment();

    try {
      injectedHost.getValue().registerDeployment(deployment, manager.start());
    } catch (ServletException e) {
      RTSLogger.ROOT_LOGGER.warn(e.getMessage(), e);
      deployment = null;
    }
  }
Exemplo n.º 3
0
  @BeforeClass
  public static void setup() throws ServletException {

    final PathHandler root = new PathHandler();
    final ServletContainer container = ServletContainer.Factory.newInstance();

    ServletInfo s = new ServletInfo("servlet", HelloServlet.class).addMapping("/aa");

    DeploymentInfo builder =
        new DeploymentInfo()
            .setClassLoader(MockRequestTestCase.class.getClassLoader())
            .setContextPath("/servletContext")
            .setClassIntrospecter(TestClassIntrospector.INSTANCE)
            .setDeploymentName("servletContext.war")
            .addServlet(s);

    DeploymentManager manager = container.addDeployment(builder);
    manager.deploy();
    deployment = manager.getDeployment();
    root.addPrefixPath(builder.getContextPath(), manager.start());

    DefaultServer.setRootHandler(root);
  }
Exemplo n.º 4
0
 @Override
 public void stop() throws Exception {
   host.getValue().unregisterDeployment(manager.getDeployment());
   manager.stop();
 }
Exemplo n.º 5
0
 @Override
 public void start() throws Exception {
   HttpHandler handler = manager.start();
   host.getValue().registerDeployment(manager.getDeployment(), handler);
 }