Two Laptop Bag*
The moose likes Servlets and the fly likes Forwarding a request to a sevlet inside context on another web server. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forwarding a request to a sevlet inside context on another web server." Watch "Forwarding a request to a sevlet inside context on another web server." New topic
Author

Forwarding a request to a sevlet inside context on another web server.

Ashish Agrawal
Ranch Hand

Joined: Nov 02, 2003
Posts: 112
I have written one servlet from which I want to pass the objects created in it to a servlet on another server. I have tried it with the sendRedirect method. It is working fine for simple strings when appended with the url query string, but how can I send bulk amount of data with the request and also have a response from there?
I have also tried using forward method, but it doesnt work for remote contexts even if a reference to remote context is acquired.
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
A forward stays on the server and is part of the same request. So you can store data as an attribute and forward. If you need to redirect to a Servlet that is part of another application on another box, redirect is always a GET reuest so the URL string is all you have.


Roland Barcia: IBM Distinguished Engineer, CTO Mobile for Lab Services
Ashish Agrawal
Ranch Hand

Joined: Nov 02, 2003
Posts: 112
Originally posted by Roland Barcia:
A forward stays on the server and is part of the same request. So you can store data as an attribute and forward. If you need to redirect to a Servlet that is part of another application on another box, redirect is always a GET reuest so the URL string is all you have.

Thats right...but as I mentioned in my post, I want to send objects and not just character data. Is there any other way like using URLConnection,etc.? If yes, how?
- Ashish Agrawal.
rick zorich
Greenhorn

Joined: Aug 31, 2003
Posts: 16
Here is some quick and dirty JSP to demonstrate. Put both files in the same directory.
------------sender.jsp----------------------------------------
-------------------------------bouncer.jsp--------------------------
Ashish Agrawal
Ranch Hand

Joined: Nov 02, 2003
Posts: 112
Thank you very much Rick
 
Don't get me started about those stupid light bulbs.
 
subject: Forwarding a request to a sevlet inside context on another web server.