Exemple #1
0
  @Override
  public List<String> getFacesServletMappings() {
    List<String> results = new ArrayList<String>();
    ServletFacet facet = project.getFacet(ServletFacet.class);
    WebAppDescriptor webXml = facet.getConfig();

    // TODO should probably take into account facelets view mappings
    // facelets.VIEW_MAPPINGS

    if (webXml.hasFacesServlet()) {
      List<ServletDef> servlets = webXml.getServlets();
      for (ServletDef servlet : servlets) {
        if ("javax.faces.webapp.FacesServlet".equals(servlet.getServletClass())) {
          List<ServletMappingDef> mappings = servlet.getMappings();
          for (ServletMappingDef mapping : mappings) {
            results.addAll(mapping.getUrlPatterns());
          }
        }
      }
    } else {
      if (webXml.getVersion().startsWith("3")) {
        results.add("*.jsf");
        results.add("/faces/*");
      } else
        ShellMessages.info(
            out,
            "FacesServlet not found in web.xml and Servlet "
                + "Version not >= 3.0, could not discover FacesServlet mappings");
    }
    return results;
  }
Exemple #2
0
 private List<String> getExplicitFacesServletMappings(final WebAppDescriptor webXml) {
   List<ServletDef> servlets = webXml.getServlets();
   List<String> results = new ArrayList<String>();
   for (ServletDef servlet : servlets) {
     if ("javax.faces.webapp.FacesServlet".equals(servlet.getServletClass())) {
       List<ServletMappingDef> mappings = servlet.getMappings();
       for (ServletMappingDef mapping : mappings) {
         results.addAll(mapping.getUrlPatterns());
       }
     }
   }
   return results;
 }