File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Redirect jsp to a private IP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Redirect jsp to a private IP" Watch "Redirect jsp to a private IP" New topic

Redirect jsp to a private IP

Vince Hon
Ranch Hand

Joined: Feb 11, 2003
Posts: 117
Dear All,
I have 2 tomcat engines on 2 separate computers, A, and B.
A and B are on the same network.
"A" is published to the Internet, it has public IP.
"B" is not published,, it has a private IP
Machine "A" , getInput.jsp will get user input from the internet and then
pass the parameters to machine "B", process.jsp to process the data.
I would like to know how "A" can send the parameter to "B" ?
Since <jsp:forward> can only be used under the same Context, I cannot use
<jsp:forward page=""> in getInput.jsp.
Also, if I use response.sendRedirect("") in getInput.jsp, since the user on the internet cannot access, this method also failed.
Are there any solution to do the internal redirect ?

Vince Hon<br /> <br />SCJP 1.4 | SCWCD | SCBCD <br /><a href="" target="_blank" rel="nofollow"></a>
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You will need to get machine A to perform its own HTTP connection to machine B and then react depending on the response from B. the problem with sendRedirect is it asks the client to reissue a request to the specified machine. Since the client can't see machine B this won't work.
Machine A is the only one that can see machine B, it will have to make the request.
A Http request may not be the best option though. You could try something like running an EJB container on B and making a remote EJB call instead. It would be harder to configure, but much easier to code.
I agree. Here's the link:
subject: Redirect jsp to a private IP
It's not a secret anymore!