This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Problem with response.sendRedirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with response.sendRedirect" Watch "Problem with response.sendRedirect" New topic
Author

Problem with response.sendRedirect

tushar borole
Greenhorn

Joined: Oct 13, 2008
Posts: 12
Hi,
I am trying to redirct one url from my action class, but getting some server error like 403- forbiddon error. n this case I can see the required url posted in the address bar,but getting 403-forbiddon error. If I copied the same url and hit in the another browser then, it is working perfect.
Can anybody help me to resolve this problem or please give me some pointers to resolve this.

URL is in the following format

http://host ort/do/login¶m1=val1¶m2=val2

Thanks,
Tushar
yashpal waghmare
Greenhorn

Joined: Sep 17, 2008
Posts: 22
Hi Tushar,

I think you have to do like this,

String url ="http://www.google.com";

response.sendRedirect(url);

//try out these 2 lines.
tushar borole
Greenhorn

Joined: Oct 13, 2008
Posts: 12
Thanks Yashpal,
The url you hav mentioned is working fine. But I need to redirect to the perticular host and specific port where my another application is running.

So he url must be http://host:<port_no>/do/doLogin/<param lists values>

Do you have any idea on the same. I guess The respose is not commiting properly or the session might have some set of values..not sure.

Thanks,
Tushar
tushar borole
Greenhorn

Joined: Oct 13, 2008
Posts: 12
Originally posted by tushar borole:
Hi,
I am trying to redirct one url from my action class, but getting some server error like 403- forbiddon error. n this case I can see the required url posted in the address bar,but getting 403-forbiddon error. If I copied the same url and hit in the another browser then, it is working perfect.
Can anybody help me to resolve this problem or please give me some pointers to resolve this.

URL is in the following format

http://host ort/do/login¶m1=val1¶m2=val2

Thanks,
Tushar
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by tushar borole:
If I copied the same url and hit in the another browser then, it is working perfect.


1. another browser means which one?

2. whether the applications running in same webserver?

3.can you post your code for redirecting?(if you dont mind)
tushar borole
Greenhorn

Joined: Oct 13, 2008
Posts: 12
1. another browser means which one?
If I copied the redirect url and enter in another window, then it is responding correctly whereas while response.sendRedirect() it is giving 403-forbidon error.

2. whether the applications running in same webserver?
They are running on different servers i.e. resins running on different machines.

3.can you post your code for redirecting?(if you dont mind)

Refer the below code:

String redirect = (String)request.getAttribute(REDIRECT_URL);
response.sendRedirect(redirect);

Here response is getting redirected properly to required url but browser showing 403-forbidon error. Now If I re-entered the same url in same browser window, it will respond properly.
tushar borole
Greenhorn

Joined: Oct 13, 2008
Posts: 12
Do anyone have pointers for the above problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with response.sendRedirect