File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes redirecturl (from servlet) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "redirecturl (from servlet)" Watch "redirecturl (from servlet)" New topic

redirecturl (from servlet)

raj guntupalli

Joined: Dec 16, 2002
Posts: 27
Hi ,
I need to send a redirect url from my servlet to a cgi app which takes the url and redirects it to the corresponding app.Can I do something like this
and can the client take it as a url string.Thanx
I am using something like
PrintWriter out = new PrintWriter(resp.getOutputStream());
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Is there a reason you can't use the response.sendRedirect() method ?
raj guntupalli

Joined: Dec 16, 2002
Posts: 27
The end application is not a browser but is a cgi or servlet etc
I am sending response like this to the client app.Is there any way I can get the response if the following code resides in one application server and the client resides in (ex lets says tomcat and is a servlet.)Can anyone help me how to write a sample client which has to get the response and then redirect it to the browser.Thanx
PrintWriter out = new PrintWriter(resp.getOutputStream());
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You might look at the HttpClient library to be found in the Apache Commons project.
There have also be a number of discussions of this type of problem here in the last few weeks so you might browse around.
I agree. Here's the link:
subject: redirecturl (from servlet)
It's not a secret anymore!