RMI in a web application
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Theodor_Gisli
Posted On:   Thursday, February 28, 2002 12:18 PM

Greetings gurus of RMI. I have a design issue that I would like to get some expert advice on. We have developed a J2EE web application with a strong MVC design pattern; java servlets that handle user input, retrieve and commit data from and to a JDBC database and build html responses for the client browser. The View, by the way, is handled very elegantly by the Velocity template engine, allowing a very clear seperation of data and presentation. We now have a requirement to implement a second client to the datastore, a Java application that is to run either on the server side (same LAN as the database and servlet container) or remotely, on the far side of firewalls and other obstacles. Furthermore,   More>>

Greetings gurus of RMI.



I have a design issue that I would like to get some expert advice on.



We have developed a J2EE web application with a strong MVC design pattern; java servlets that handle user input, retrieve and commit data from and to a JDBC database and build html responses for the client browser. The View, by the way, is handled very elegantly by the Velocity template engine, allowing a very clear seperation of data and presentation.



We now have a requirement to implement a second client to the datastore, a Java application that is to run either on the server side (same LAN as the database and servlet container) or remotely, on the far side of firewalls and other obstacles. Furthermore, there is a requirement to implement applets that have limited access to the same datastore, also, obviously, run remotely.



Now, the immediate solution was to package things nicely up in a business logic jar file to distribute with each client. Remote communication would go through the servlets that would continue to provide access to the datastore. Pretty standard approach while EJB's and the heavy app servers are not an option.



But, isn't this excactly the sort of thing RMI is good at? If we were to split the current web application into servlet based request/response/session handler and creating a RMI application around the data layer, each of the clients (Java application, web application and applets) would talk to the data layer through RMI, being remote or local. Encapsulating all database functionality in a RMI application would keep the data layer in one place, data validation only done in one place, one codebase.



With my limited knowledge of RMI, it seems a perfect fit. I have only done a simple proof-of-concept prototype and before I go further, I would like to hear if this architecture is valid. RMI is designed for Java objects to remotely call methods in other Java objects but it is not clear to me if it is efficient to use in a servlet based web application environment. Does RMI perform as a servlet connector to a backend database. And in a database application? I am aware that remote clients will of course have bandwith issues, especially if tunnelled through HTTP.



I need a sanity check, is this a sound design, or am I loading the gun and about to shoot myself in the foot?



Have you gurus done an application with this approach and can you share your experience?



Thanks in advance,

Theodor Gisli

   <<Less
About | Sitemap | Contact