Jan, I do have an HandlerCollection, all contexts are set to HandlerCollection. I also have an HandlerList with few other handlers. but right now I am setting my HandlerList in to my HandlerCollection. As you said it should be the other way around. I'll fix that.
Are you suggesting that I better change my multithreaded approach? - Varsha On Tue, Apr 12, 2016 at 3:31 PM, Jan Bartel <[email protected]> wrote: > Varsha, > > Just to emphasize - I think you want a ContextHandlerCollection, not a > HandlerList - a HandlerList tries each handler (or context in your case) in > order, whereas a ContextHandlerCollection picks the best matching context > from the path of the request. It would be most unusual to have a > HandlerList of contexts. So fix this first before changing your > multithreaded approach. > > Jan > > On 12 April 2016 at 19:52, Varsha Gopal <[email protected]> wrote: > >> Thanks Jan. Much appreciated! >> >> I'll try to clarify the flow a bit more. >> >> My main thread creates and starts the Jetty Server - as attached in >> Jetty_Server.txt >> Once Server is started, it spawns x number of threads depending on the >> number of contexts I have to deploy in the server [ whats attached in >> Jetty_Context.txt , which basically is creating instances of >> org.eclipse.jetty.webapp.WebAppContext and attaching to HandlerCollection >> of the Server. ] What we are trying to achieve is an hot deploy of sorts in >> to HandlerCollection. And if I understand correctly, HandlerCollection is >> mutable which would allow hot deploy. >> >> Now, as you mentioned, if it's allowed only in Single thread, then Yes, I >> would have a problem. Where can I find a confirmation to this without >> burning my fingers, you think? >> Just FYI , I have tried out the single thread, multiple context approach >> and that works. No handlerCollection here, just keeping on >> adding WebAppContext to HandlerList. >> >> I will try out your suggestion of adding HandlerCollection to HandlerList >> rather than the other way around. >> >> Thanks, >> Varsha >> >> >> >> >> >> On Tue, Apr 12, 2016 at 2:16 PM, Jan Bartel <[email protected]> wrote: >> >>> Varsha, >>> >>> I'm not sure how those two code snippets you attached relate to each >>> other, but some observations: >>> >>> * A HandlerList is not the same thing as a ContextHandlerCollection. >>> Normally, if you're creating multiple contexts you would add them to a >>> ContextHandlerCollection (which itself is added to a HandlerList). The >>> ContextHandler collection has significant behavioural differences to a >>> HandlerList. Have a read of >>> http://www.eclipse.org/jetty/documentation/current/architecture.html >>> for some pointers on that. >>> >>> * I don't think that simultaneous deployment of webapps is particularly >>> supported - usually the deployment process is single threaded so it's >>> possible you might hit some funky behaviour. >>> >>> cheers >>> Jan >>> >>> On 11 April 2016 at 14:47, Varsha Gopal <[email protected]> wrote: >>> >>>> >>>> Any pointers for the below query? >>>> >>>> ---------- Forwarded message ---------- >>>> From: Varsha Gopal <[email protected]> >>>> Date: Thu, Apr 7, 2016 at 11:47 AM >>>> Subject: Need Help with Embedded Jetty - Adding multiple context >>>> through Mutable Handle Collection >>>> To: [email protected] >>>> >>>> >>>> Is it right to start a jetty instance with no context specified and no >>>> context handler, then keep adding context to it once the server has >>>> started. Although I was able to do this using mutable HandlerCollection and >>>> the logs says the Server and the Contexts are Started and Available, I am >>>> not able to access it with a URL with the context [ Not Found error / 404]. >>>> >>>> Should we add at least one root context and contexthandler to the >>>> server while starting it? >>>> >>>> My main thread starts the server. Post that it will spawn couple of >>>> threads which each creates WebAppContext and start them. >>>> >>>> My jetty version is 9.3.7.v20160115 >>>> >>>> Bit of the code where I am starting the server and contexts are >>>> attached, along with few inline comments >>>> >>>> P.S If I start Server and context in one go without any >>>> handlercollection, i.e each context in its own server instance and finally >>>> just start the server, it's working. I am able to access it with the >>>> contextpath for the same jars in the classpath. >>>> >>>> Thanks in advance, >>>> Varsha >>>> >>>> >>>> _______________________________________________ >>>> 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 assistance from the creators of Jetty and CometD* >>> >>> >>> _______________________________________________ >>> 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 >>> >> >> >> _______________________________________________ >> 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 assistance from the creators of Jetty and CometD* > > > _______________________________________________ > 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 >
_______________________________________________ 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
