You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2014/10/03 16:55:54 UTC

Websocket message from Spring bean

Hello All,

I wonder is it possible to send IWebSocketPushMessage from Spring bean? (I
can access Spring beans from wicket pages, now I need "backward
compatibility")

Thanks in advance for your help!

-- 
WBR
Maxim aka solomax

Re: Websocket message from Spring bean

Posted by Maxim Solodovnik <so...@gmail.com>.
Finally was able to test it :)
Everything works as expected! Thanks a lot for the hint!

On Tue, Oct 7, 2014 at 5:49 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Thanks a lot for the tip Martin!
> will give it a try and write back :)
>
> On 7 October 2014 16:39, Martin Grigorov <mg...@apache.org> wrote:
>
>> You use request and session scoped Spring beans in WebSocket request
>> because such requests are not processed by Servlet filters and Spring has
>> no chance to set its proxy objects as request/session attributes.
>>
>> But in Spring bean code you can do:
>> Application app = Application..get("myFilterName");
>> WebSocketSettings wsSettings = WebSocketSettings.Holder.get(app);
>> IWebSocketConnectionRegistry registry =
>> wsSettings.getConnectionRegistry();
>> WebSocketPushBroadcaster broadcaster = new
>> WebSocketPushBroadcaster(registry);
>> broadcaster....
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Oct 7, 2014 at 11:31 AM, Maxim Solodovnik <so...@gmail.com>
>> wrote:
>>
>> > To be fair I haven't tried :(
>> > I thought I will have "no session/application bound to current thread"
>> > exceptions :(
>> > I'll test and let you know
>> >
>> > On 7 October 2014 15:21, Martin Grigorov <mg...@apache.org> wrote:
>> >
>> > > Hi,
>> > >
>> > > I think it should work.
>> > > What kind of problems do you face ?
>> > >
>> > > Martin Grigorov
>> > > Wicket Training and Consulting
>> > > https://twitter.com/mtgrigorov
>> > >
>> > > On Fri, Oct 3, 2014 at 4:55 PM, Maxim Solodovnik <
>> solomax666@gmail.com>
>> > > wrote:
>> > >
>> > > > Hello All,
>> > > >
>> > > > I wonder is it possible to send IWebSocketPushMessage from Spring
>> bean?
>> > > (I
>> > > > can access Spring beans from wicket pages, now I need "backward
>> > > > compatibility")
>> > > >
>> > > > Thanks in advance for your help!
>> > > >
>> > > > --
>> > > > WBR
>> > > > Maxim aka solomax
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > WBR
>> > Maxim aka solomax
>> >
>>
>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: Websocket message from Spring bean

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot for the tip Martin!
will give it a try and write back :)

On 7 October 2014 16:39, Martin Grigorov <mg...@apache.org> wrote:

> You use request and session scoped Spring beans in WebSocket request
> because such requests are not processed by Servlet filters and Spring has
> no chance to set its proxy objects as request/session attributes.
>
> But in Spring bean code you can do:
> Application app = Application..get("myFilterName");
> WebSocketSettings wsSettings = WebSocketSettings.Holder.get(app);
> IWebSocketConnectionRegistry registry = wsSettings.getConnectionRegistry();
> WebSocketPushBroadcaster broadcaster = new
> WebSocketPushBroadcaster(registry);
> broadcaster....
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 7, 2014 at 11:31 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > To be fair I haven't tried :(
> > I thought I will have "no session/application bound to current thread"
> > exceptions :(
> > I'll test and let you know
> >
> > On 7 October 2014 15:21, Martin Grigorov <mg...@apache.org> wrote:
> >
> > > Hi,
> > >
> > > I think it should work.
> > > What kind of problems do you face ?
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 3, 2014 at 4:55 PM, Maxim Solodovnik <solomax666@gmail.com
> >
> > > wrote:
> > >
> > > > Hello All,
> > > >
> > > > I wonder is it possible to send IWebSocketPushMessage from Spring
> bean?
> > > (I
> > > > can access Spring beans from wicket pages, now I need "backward
> > > > compatibility")
> > > >
> > > > Thanks in advance for your help!
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: Websocket message from Spring bean

Posted by Martin Grigorov <mg...@apache.org>.
You use request and session scoped Spring beans in WebSocket request
because such requests are not processed by Servlet filters and Spring has
no chance to set its proxy objects as request/session attributes.

But in Spring bean code you can do:
Application app = Application..get("myFilterName");
WebSocketSettings wsSettings = WebSocketSettings.Holder.get(app);
IWebSocketConnectionRegistry registry = wsSettings.getConnectionRegistry();
WebSocketPushBroadcaster broadcaster = new
WebSocketPushBroadcaster(registry);
broadcaster....

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 7, 2014 at 11:31 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> To be fair I haven't tried :(
> I thought I will have "no session/application bound to current thread"
> exceptions :(
> I'll test and let you know
>
> On 7 October 2014 15:21, Martin Grigorov <mg...@apache.org> wrote:
>
> > Hi,
> >
> > I think it should work.
> > What kind of problems do you face ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 3, 2014 at 4:55 PM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Hello All,
> > >
> > > I wonder is it possible to send IWebSocketPushMessage from Spring bean?
> > (I
> > > can access Spring beans from wicket pages, now I need "backward
> > > compatibility")
> > >
> > > Thanks in advance for your help!
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Websocket message from Spring bean

Posted by Maxim Solodovnik <so...@gmail.com>.
To be fair I haven't tried :(
I thought I will have "no session/application bound to current thread"
exceptions :(
I'll test and let you know

On 7 October 2014 15:21, Martin Grigorov <mg...@apache.org> wrote:

> Hi,
>
> I think it should work.
> What kind of problems do you face ?
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 3, 2014 at 4:55 PM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello All,
> >
> > I wonder is it possible to send IWebSocketPushMessage from Spring bean?
> (I
> > can access Spring beans from wicket pages, now I need "backward
> > compatibility")
> >
> > Thanks in advance for your help!
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: Websocket message from Spring bean

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think it should work.
What kind of problems do you face ?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 3, 2014 at 4:55 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> I wonder is it possible to send IWebSocketPushMessage from Spring bean? (I
> can access Spring beans from wicket pages, now I need "backward
> compatibility")
>
> Thanks in advance for your help!
>
> --
> WBR
> Maxim aka solomax
>