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);
Is there a reason you can't use the response.sendRedirect() method ?
Joined: Dec 16, 2002
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);
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