• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can rmi be used with servlets?

 
Arun Martin
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am a beginner to servlets. i was informed that jdbc and applets could be used with servlets. i would like to know whether rmi could be used with servlets. if so how?


with regards,
arun.
 
Vladan Radovanovic
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RMI runs over JRMP or IIOP. Servlets are server side java modules that extend the functionality of a server. Servlets out there are mostly HTTPServlets and they extend the functionality of the Web server. Because they run on HTTP, can't be used. I would guess that then GenericServlet can be used because it is protocol-independent. I haven't had a chance to see one example that has used it though.
Please anybody correct me if I am wrong!
Vladan
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But an HttpServlet is a GenericServlet
So anything that a GenericServlet can do, and HttpServlet can also do.
But most importantly, Servlets have access to the whole Java API including RMI.
They use HTTP to communicate back to the client (a browser?) But nothing prevents them from using any other protocol to communicate. They could open sockets to other servers if needed, e.g.
 
Frank Lin
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Servlet can work with RMI. I have created a servlet front end that invokes a remote object on another host to perform a socket connectivity test and returns the test result back to the servlet. It works perfectly.
This reply may be a little too late. I am new to this site and found the info here is very helpful. Just try to make some contribution.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets can do anything a Java application can do - I have a RMI example in the servlets book. Basically the only things you have to watch out for are catching exceptions and synchronizing access.
Bill
------------------
author of:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic