• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redirecturl (from servlet)

 
raj guntupalli
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
buffer.append("SomeServlet");
buffer.append("JSESSIONID=");
buffer.append(sessionValue);
buffer.append("?");
buffer.append(req.getAttribute("remoteURLExpirationID").toString());
buffer.append("=");
buffer.append(System.currentTimeMillis());
PrintWriter out = new PrintWriter(resp.getOutputStream());
out.println(urlString);
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a reason you can't use the response.sendRedirect() method ?
 
raj guntupalli
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
resp.setContentType("text/html");
PrintWriter out = new PrintWriter(resp.getOutputStream());
out.println(plainUrl);
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic