-
1. Re: How to integrate Weld with web socket
emilyj Mar 4, 2015 11:19 AM (in response to emilyj)Can someone respond to my question?
-
2. Re: How to integrate Weld with web socket
jharting Mar 5, 2015 2:56 AM (in response to emilyj)Hi Emily,
you'll need to obtain ServlerEndpoint / ClientEndpoint instance from Weld using BeanManager instead of directly calling constructor. Other than that, no special integration should be required.
-
3. Re: How to integrate Weld with web socket
emilyj Mar 16, 2015 6:29 PM (in response to jharting)Thanks Jozef! With your help, the dependent and application scoped beans seem to work. However, the SessionScoped bean injection failed with the following error:
Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:691)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:79)
at org.jboss.weld.bean.proxy.CachedBeanInstance.getInstance(CachedBeanInstance.java:66)
I guess I need to activate the SessionScoped context. In web container, this is done via WeldInitialListener. As websocket goes through a different channel rather than http request, how can I activate the SessionScopedContext?
-
4. Re: How to integrate Weld with web socket
emilyj Mar 19, 2015 8:12 AM (in response to emilyj)Can someone help to answer my question? Thanks in advance!
-
5. Re: How to integrate Weld with web socket
jharting Mar 19, 2015 9:59 AM (in response to emilyj)Sorry, I missed your question. AFAIK the session context is not supported to be active during WebSocket notification.
-
6. Re: How to integrate Weld with web socket
emilyj Mar 19, 2015 6:04 PM (in response to jharting)If the session context is not active, how can the sessionscoped beans work in the WebSocket?
-
7. Re: How to integrate Weld with web socket
jharting Mar 20, 2015 5:11 AM (in response to emilyj)They do not work
-
8. Re: How to integrate Weld with web socket
emilyj Mar 23, 2015 6:05 PM (in response to jharting)Thanks Jozef! Is this mentioned in any spec?
-
9. Re: How to integrate Weld with web socket
jharting Mar 24, 2015 2:16 AM (in response to emilyj)It's the other way around. It's not mentioned in section 6.7.2 of the CDI spec nor in Chapter 7 of the WebSocket spec.