Thanks, I will try this. On Mon, Jan 20, 2020 at 8:56 AM Simone Bordet <[email protected]> wrote:
> Hi, > > On Mon, Jan 20, 2020 at 4:53 PM Josh Spiegel <[email protected]> wrote: > > > > I have the ConnectionFactory and the Connection implementations. > > I have the Servlet (deployed in a war file) > > > > The ConnectionFactory/Connection are deployed using a Jetty module/xml > with start.jar. > > The servlet is deployed by dropping the war file in webapps. > > > > I have some dynamic state (mainly database connection pools) that I > would like to share between the ConnectionFactory and the Servlet. > > > > I can set the state object as a context attribute from the servlet. > However, then it isn't clear to me how I would retrieve it from either the > ConnectionFactory or Connection. > > I would create your shared state bean, and add it as a Server > attribute - this can be done via a Jetty XML file and module like you > have already done. > This bean would then be easily retrievable from the ConnectionFactory > implementation, and passed to Connections. > > You can then have a custom context XML file for your webapp, that > retrieves the bean from the server and sets it as a context attribute. > This file can be something like (pseudo code to convert to XML): > > Server server = this.getServer(); > Object bean = server.getAttribute("mySharedBean"); > this.setAttribute("mySharedBean", bean); > > where "this" is a WebAppContext (as per Jetty context XML file). > > -- > Simone Bordet > ---- > http://cometd.org > http://webtide.com > Developer advice, training, services and support > from the Jetty & CometD experts. > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://www.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://www.eclipse.org/mailman/listinfo/jetty-users
