Accessing RequestGlobals from Atmosphere handlers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing RequestGlobals from Atmosphere handlers

Ilya Obshadko
Hi!

I'm integrating Atmosphere in my project, but without using
tapestry-atmosphere (I intend to keep Atmosphere separate from Tapestry
itself, much similar to RestEasy integration).

I have managed to get it working, however I have issues propagating
@PerThread services (like RequestGlobals) to Atmosphere handlers. When
WebSocket is opened, the initial request runs on the same thread, and I
manually populate RequestGlobals before calling Atmosphere framework
processing. Still, both getRequest() and getResponse() are nulls inside the
handler method.

Could somebody familiar with Atmosphere point me in the right direction?

Filter implementation & HttpServletRequestHandler contribution:
https://gist.github.com/xfyre/dd84087929b1bb4627bcf3fe6df9a6cb

Sincerely,
--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: Accessing RequestGlobals from Atmosphere handlers

Ilya Obshadko
After some digging I found why this is happening: Atmosphere is
asynchronous, and perthreadManager.cleanup() call happens before Atmosphere
handler invocation.

I'm sort of confused - is there any way around this? Any suggestions?

On Mon, Sep 14, 2020 at 7:43 PM Ilya Obshadko <[hidden email]> wrote:

> Hi!
>
> I'm integrating Atmosphere in my project, but without using
> tapestry-atmosphere (I intend to keep Atmosphere separate from Tapestry
> itself, much similar to RestEasy integration).
>
> I have managed to get it working, however I have issues propagating
> @PerThread services (like RequestGlobals) to Atmosphere handlers. When
> WebSocket is opened, the initial request runs on the same thread, and I
> manually populate RequestGlobals before calling Atmosphere framework
> processing. Still, both getRequest() and getResponse() are nulls inside the
> handler method.
>
> Could somebody familiar with Atmosphere point me in the right direction?
>
> Filter implementation & HttpServletRequestHandler contribution:
> https://gist.github.com/xfyre/dd84087929b1bb4627bcf3fe6df9a6cb
>
> Sincerely,
> --
> Ilya Obshadko
>
>

--
Ilya Obshadko