File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Redirecting HttpServletRequest to another resource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting HttpServletRequest to another resource" Watch "Redirecting HttpServletRequest to another resource" New topic
Author

Redirecting HttpServletRequest to another resource

Pradeep Sahoo
Ranch Hand

Joined: Oct 13, 2002
Posts: 46
Hi folks,
I would like to redirect my incoming servlet request to another resource(full URL availabe) outside of my server.
My request contains Http Headers as well as some parameters.
Can anyone suggest me how to do it?
I want the new resource to get all the header as well as parameter information.
I am using Weblogic 6.1 ( I guess Servlet 2.2).
Thanks,


Pradeep<br />Consultant - Enterprise Solutions,<br />Infosys Technologies Ltd,<br />Bangalore, India
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12787
    
    5
You can't redirect and preserve the parameters because redirect creates a new request. What you can do is have your servlet create a connection to the other resource and fake the request, then just pass the results back as your response.
Bill
Pradeep Sahoo
Ranch Hand

Joined: Oct 13, 2002
Posts: 46
Thanks Bill for your answer.
If you could explain me with a short code snippet it would be great.
Thanks,
Pradeep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting HttpServletRequest to another resource