Dear all,
I try to use the Forms-Based authentication within an embedded Jetty 6.1.7 project.
That's why I need to serve servlets and html (login.html) under the same context to make authentication work. I don't want to secure the hole application since different context should need different roles. The jetty javadoc states that a ContextHandlerCollection can handle different handlers for one context but I don't get it to work. My sample ignoring the authentication stuff will not work, why?
ContextHandlerCollection contexts = new ContextHandlerCollection();
// serve html
Context ctxADocs= new Context(contexts,"/ctxA",Context.SESSIONS);
ctxADocs.setResourceBase("d:\\tmp\\ctxA");
ServletHolder ctxADocHolder= new ServletHolder();
ctxADocHolder.setInitParameter("dirAllowed", "false");
ctxADocHolder.setServlet(new DefaultServlet());
ctxADocs.addServlet(ctxADocHolder, "/");
// serve a sample servlet
Context ctxA = new Context(contexts,"/ctxA",Context.SESSIONS);
ctxA.addServlet(new ServletHolder(new SessionDump()), "/sda");
ctxA.addServlet(new ServletHolder(new DefaultServlet()), "/");
contexts.setHandlers(new Handler[]{ctxA, ctxADocs});
// end of snippet
Any helpful thought is welcome!
Thanks.
Okami