Exemplo n.º 1
0
  private ContextHandlerCollection findContextHandlerCollection(Handler[] handlers) {
    if (handlers == null) return null;

    for (Handler handler : handlers) {
      if (handler instanceof ContextHandlerCollection) {
        return (ContextHandlerCollection) handler;
      }

      if (handler instanceof HandlerCollection) {
        HandlerCollection hc = (HandlerCollection) handler;
        ContextHandlerCollection chc = findContextHandlerCollection(hc.getHandlers());
        if (chc != null) return chc;
      }
    }
    return null;
  }
Exemplo n.º 2
0
  public static void configureJetty(Server server, HandlerCollection collection) {
    Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
    classlist.addBefore(
        "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
        "org.eclipse.jetty.annotations.AnnotationConfiguration");

    // Set the ContainerIncludeJarPattern so that jetty examines these
    // container-path jars for tlds, web-fragments etc.
    // If you omit the jar that contains the jstl .tlds, the jsp engine will
    // scan for them instead.
    for (Handler handler : collection.getHandlers()) {
      if (handler instanceof WebAppContext) {
        ((WebAppContext) handler)
            .setAttribute(
                "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");
      }
    }
  }