开发者

How can I get a server to notify the client about changes using the spring Framework?

开发者 https://www.devze.com 2023-04-04 23:17 出处:网络
I\'m starting to develop what should become a client-server Application using Hibernate, Spring and Eclipse RCP (for the client). This is the first time I\'m designing an application from the beginnin

I'm starting to develop what should become a client-server Application using Hibernate, Spring and Eclipse RCP (for the client). This is the first time I'm designing an application from the beginning so I'm just making my first steps.

I have set up Spring on both client and server using RMI for remoting (but I wouldn't mind using something else if there was a clear advantage). So right now I'm able to call exposed services of the server from different clients to get information from the database. What I haven't done is get any kind of authentication in place, so basically the server just answers to the different clients without knowing anything about them, there is not concept of a session yet. Of course this has to change since I need different user to have different roll and so on, but right now the problem I'm facing is getting the server to notify the client when certain thing happen.

My idea to solve this problem was to have a queue of events at the Server and have the clients get them every 3 second or so. The server would then identify the client by it's session token and send the appropriate events. Yet my开发者_高级运维 partner in this project is concerned that this technique (polling) might waste too much bandwidth unnecessarily.

So to bring it to the point. What are the standard techniques for a server to notify a client about changes using Spring? Please notice that I'm not developing a web application and that this is only intended to be used withing a private network. That is one of the difficulties I've been facing: every single tutorial about Spring security or remoting assumes you are making a web application, but I really don't want to get lost into the details of Spring MVC and web applications in general.

Any resources would be appreciated. A good and long tutorial on the matter would be great.

EDIT: Hmm, it looks like JMS might be what I'm looking for.


As I understand, the issues you are facing is identifying a client in request and correlate different client request i.e. have something like a session.

Spring also support RMI over HTTP protocol (Using Hessian and its own HTTP Invokers). Check out this link (Section 17.3). Now once you have transport as HTTP, it has inherent Basic Authentication and session which can be leveraged to get around the issues you are facing.

This is just a pointer. I would be curious to know how eventually you resolved your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号