aspose file tools*
The moose likes Servlets and the fly likes forwarding requests from web server to 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 requests from web server to web server" Watch "forwarding requests from web server to web server" New topic
Author

forwarding requests from web server to web server

Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
This may sound odd, but I would like advice on sending a request from one web server to another. For example, servlet S1 on web server A receives a requests and forwards it to servlet S2 on web server B. I know I can create a HttpURLConnection in servlet S1, but does anyone have any better suggestions? Thanks


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
Have you considered using the sendRedirect method of HttpServletResponse? You have to use it before any text has been sent - it tells the user's browser to do a new request to the specified URL.
Bill


Java Resources at www.wbrogden.com
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Thanks for the reply... Is that the only other way to get the job done?
Harpartap Singh
Greenhorn

Joined: Sep 14, 2002
Posts: 23
Get the ServletContext of the OTHER web app.
Using this new ServletContext, create a RequestDispatcher to the servlet you want to access, and then forward your request...

Or something like this.
/hs


<blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Lance Armstrong: "What am I on? I'm on my bike, busting my ass six hours a day. What are you on?"<hr></blockquote>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forwarding requests from web server to web server
 
Similar Threads
compare Servlets
Part II - Deployment Diagram.
Servlet container - what is the real definition?
RMI in applet
What is meant by "Web Server"