Community
Participate
Working Groups
I created a Jetty configuration with a custom ContextHandler (UrlToApplicationHandler). This handler waits for the first hit. If the hit arrives it lazily initializes the real application delegates to this. There can be multiple such handlers (for different URLs) all delegating to the same application. Initially the stack looks like this: org.eclipse.jetty.server.Server +-HandlerCollection +-ContextHandlerCollection | +-UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test/v1] | +-UrlToApplicationHandler$LazyInitializingHotSwapDelegator | +-UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test] | +-UrlToApplicationHandler$LazyInitializingHotSwapDelegator +-DefaultHandler If I now hit an unmatched URL (http://localhost/) the DefaultHandler triggers and lists both available UrlToApplicationHandler contexts. DefaultHandler: /test/v1 @ localhost:80 ---> UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test/v1] /test @ localhost:80 ---> UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test] If I then hit an actual context URL the application is initialized lazily and put into the stack (all implemented by my LazyInitializingHotSwapDelegator which is a HotSwapHandler). The stack now looks like this: org.eclipse.jetty.server.Server +-HandlerCollection +-ContextHandlerCollection | +-UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test/v1] | +-UrlToApplicationHandler$LazyInitializingHotSwapDelegator | +-MyApplicationHandler [applicationId=myApp] | +-UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test] | +-UrlToApplicationHandler$LazyInitializingHotSwapDelegator +-DefaultHandler If I now hit the DefaultHandler it displays _three_ contexts available. DefaultHandler: /test/v1 @ localhost:80 ---> UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test/v1] /test @ localhost:80 ---> UrlToApplicationHandler [applicationId=myApp, url=http://localhost/test] / ---> MyApplicationHandler /,null However, the MyApplicationHandler actually is not reachable because it's never handled by the ContextHandlerCollection (which is the intended behavior). I'm wondering if DefaultHandler should have the same view as ContextHandlerCollection?
Gunnar, It is probably a good idea for the default servlet to print the handler tree itself, with any URLs that is can work out. I've changed this to be an enhancement request and we will see if we can get time for it.... happy for code contributions also.
Gunnar, sorry for long delay. Also I've changed my mind on this one. The DefaultHandler just lists all Contexts know to the server. It can't know if they are actually reachable as there are an infinite number of ways handlers can direct requests to contexts and ContextHandlerCollection is just one way (ok it is the default and most common way). So I'm going to leave it as is.... but feel free to try to convince me otherwise. cheers
Not sure I will. I wrote a bunch of new handlers already so this is no longer an issue for me. ;)
Resolved -> Closed