views:

60

answers:

2

We are seeing Spring in school right now but we don't have the time to wait till the end of the semester to start developing an application. We continue using an app we made last year, and are writing the service layer right now.

The problem is our "client" wants to have a desktop client and a webpart, which used the same dtatabase. This would be no problem if we hook up a server that can handle RMI. So basically we want to be able to retrieve/send data to the server that runs our service layer, and use the objects on the client side as well.

I have no idea where to start digging in Spring to figure out how to do this, so some help would be appreciated.

PS: At this point I do not need MVC yet. MVC is handled from within the desktop app where we have views and controllers.The model is the same from the one on the service layer. How do we use the same model without copying it?

+1  A: 

You might want to take a look at the REST paradigms. With this in mind you could have a web server running your server part of the application and communicating with clients through the HTTP protocol. A simple client could be a webpage in the browser which gets the corresponding HTML pages from the server, or a Swing client which communicates over JSON with the server.

The server can implement different methods for JSON or HTML communication and the server can decide what implementation to use by looking at the Accept Header of the Request objects sent to it, that's what they call Content Negotiation

JSR-311 is implemented as Project Jersey which is a framework for RESTful webservices. You might want to take a look at that.

hope that helped

smeg4brains
+3  A: 

Check out spring remoting: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html It's easy to expose your spring beans remotely, using a variety of protocols.

EJB
I came to the conclusion that I don't need remoting right now and thank god.(even if it's simple, I'd rather avoid it for now). If I just put my service layer + DAO in a maven module, I'm good to go with a remote SQL server.
toomuchcs