简体   繁体   English

如何使用Java将通知从EJB容器发送到Web容器

[英]How to send notification from EJB container to web container in Java

I want to send notification from EJB container to Web container showing that something has occured on the service layer. 我想将通知从EJB容器发送到Web容器,以表明服务层已发生某些事情。
Basically my service layer is on EJB container and i get request from client on my web service and want to tell web container that some request has occured. 基本上,我的服务层在EJB容器上,我从Web服务上的客户端获取请求,并想告诉Web容器已经发生了一些请求。

I face same problem sometime ago and i done it using AJAX. 我前段时间遇到了同样的问题,我使用AJAX做到了。 i found that you cannot send notification from EJB container to web container rather you must explicitly check from web container by polling to EJB container. 我发现您无法将通知从EJB容器发送到Web容器,而是必须通过轮询EJB容器来显式检查Web容器。 U can set a boolean variable whenever you get request at EJB container, and check that variable value at Web container by pooling after sometime so if that boolean is true this mean that you have some notification and you can get that notification. 每当您在EJB容器处获得请求时,U都可以设置一个布尔变量,并在一段时间后通过池化在Web容器中检查该变量值,因此,如果该布尔值是true,则意味着您有一些通知,并且可以获取该通知。
I have done this by above method hope this works for u 我已经通过上面的方法做到了这一点,希望对你有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM