This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 12761
    
    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
 
wood burning stoves
 
subject: Redirecting HttpServletRequest to another resource
 
Similar Threads
"jsp:include page=..." and refresh
2 webs apps one class
Send Redirect
forward and sendRedirect methods
Inter Servlet Communication