Пример #1
0
 private void removeConflictingErrorPages(Node root) {
   List<Node> nodeList = root.get("error-page");
   for (Node errorPage : nodeList) {
     String errorCode = errorPage.getTextValueForPatternName("error-code");
     if (errorCode.equals("404") || errorCode.equals("500")) {
       // TODO: Prompt before removing? A prompt existed in Forge 1.
       root.removeChild(errorPage);
     }
   }
 }
Пример #2
0
  @Test
  public void testInstallWebIntoXML() throws Exception {
    Project project = getProject();

    assertFalse(project.hasFacet(RestFacet.class));
    setupRest();

    assertTrue(project.hasFacet(RestFacet.class));
    assertTrue(project.getFacet(DependencyFacet.class).hasEffectiveDependency(JAX_RS_DEPENDENCY));

    ServletFacet web = project.getFacet(ServletFacet.class);
    Node servletName =
        ((WebAppDescriptorImpl) web.getConfig())
            .getRootNode()
            .getSingle("servlet-mapping/servlet-name=" + RestWebXmlFacetImpl.JAXRS_SERVLET);
    assertNotNull(servletName);
    assertEquals("/rest/*", servletName.getParent().getSingle("url-pattern").getText());
  }