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.

Thanks,
Josh







On Mon, Jan 20, 2020 at 1:29 AM Simone Bordet <[email protected]> wrote:

> Hi,
>
> On Mon, Jan 20, 2020 at 12:36 AM Josh Spiegel <[email protected]>
> wrote:
> >
> > Hi,
> >
> > What is the cleanest way for a servlet (e.g. in a war file under
> webapps) to communicate state with a custom ConnectionFactory running in
> the same server?
>
> A custom ConnectionFactory typically creates Connections that parse
> bytes that have been read from the network.
> If that's the case, then your servlet should open a socket and write
> the custom protocol bytes so that they can be read and parsed by the
> custom Connection - basically you have to write a client for your
> custom protocol.
>
> > Is there is some way to set Server attributes from the servlet or
> something like that?
>
> You need to detail what you want to do here, and consider the
> lifetimes of the objects you want to deal with.
> You do not want that a second request to the servlet overwrites the
> attribute set by the first request.
>
> > A static variable would probably work for me but I am hoping for
> something that is more decoupled and scoped at the Server level.
>
> I doubt a static will work - would not be overwritten for every request?
>
> Can you detail the problem first, rather than the solution?
>
> --
> 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

Reply via email to