Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty 12 schedule?

> The only practical way to inject the per-request interfaces into various objects is to use thread-local storage to capture and stash the current Servlet request/response and then inject a façade that pulls the thread-local copy out and delegates the method calls to it.

Jakarta Servlet 5 deprecated jakarta.servlet.SingleThreadModel, and Servlet 6 removed it.

You cannot use thread-local reliably starting in Jakarta Servlet 5.

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Wed, Nov 9, 2022 at 3:08 PM Cantor, Scott <cantor.2@xxxxxxx> wrote:
>    Scott, I'm not understanding how your facades work or why exactly
> they are needed?  Can you give some examples?

We have a deeply modular Spring-based system, where beans very "high" up need access to request/response state. The only practical way to inject the per-request interfaces into various objects is to use thread-local storage to capture and stash the current Servlet request/response and then inject a façade that pulls the thread-local copy out and delegates the method calls to it.

This is, among other things, a way to allow Spring ot instantiate components from third-party libraries that depend on Servlet APIs.

It's not to say we can't come up with other ways, but it's very widespread in our current design.

> Why can you not just deploy old javax. * code to one context and new
> jakarta. * code to a different one.

You're focused on javax/jakarta but that's not the issue. We already ported to jakarta. Both Servlet 5 and 6 are jakarta. The problem is they're not the same/compatible API, there are breaking changes in 6 removing deprecated methods that have been around a while.

-- Scott


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top