Neil,

I'm not really sure why you want to do that?

It is the ContextHandlerCollection that has the smarts to choose
amongst the best context paths that match the request. As the request
is eg  /base/a/xxxx then none of your PrintHandlers match that.

This will certainly work:
chc.setHandlers(new Handler[] {new PrintHandler("/base/a"), new
PrintHandler("/base/b"), new PrintHandler("/base/c")});

cheers
Jan

On 9 September 2014 21:46, Neil Williams <[email protected]> wrote:
> Looking at having the following:
>
> public class ContextPlay {
>   public static void main(String[] args) throws Exception {
>     Server server = new Server(8000);
>
>     ContextHandlerCollection chc = new ContextHandlerCollection();
>     chc.setHandlers(new Handler[] {new PrintHandler("/a"), new
> PrintHandler("/b"), new PrintHandler("/c")});
>
>     ContextHandler ch = new ContextHandler("/base")
>     ch.setHandler(chc);
>
>     server.setHandler(ch);
>
>     server.start();
>     server.join();
>   }
>
>   public static class PrintHandler extends ContextHandler {
>     public PrintHandler(String context) {
>       super(context);
>     }
>
>     @Override
>     public void doHandle(String target, Request baseRequest,
> HttpServletRequest request,
>         HttpServletResponse response) throws IOException, ServletException {
>       response.getWriter().print(getContextPath());
>       baseRequest.setHandled(true);
>     }
>   }
> }
>
> So a base ContextHandler with the ContextHandlerCollection as the
> ContextHandler's child handler.
>
> A request to http://localhost:8000/base/c will 404, a request to
> http://localhost:8000/base/a will succeed. Is this sort of chaining meant to
> be supported by Jetty? It would certainly be useful.
>
> Thanks, Neil
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users



-- 
Jan Bartel <[email protected]>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to