This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting problem while redirecting the URL

 
tushar borole
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using response.sendRedirect() to redirect the URL.
The URL format is as below

http://<host ort>/context?<param1=val1>&<param2=val2>&<param3=val3>

code is as below

e.g.
redirectURL = http://<host ort>/context<param1=val1>&<param2=val2>&<param3=val3>
[Note : runtime host, port, all params and values are getting populated correctly.]

response.sendRedirect(redirectURL);

Now , I can see the generated url in address bar with 403-forbidon error.

But if I re-entered the same url, it will work properly. It means I need to re-enter the url, then it will show the result.

Do any one have pointers to resolve this issue?

As per my analysis, if the redirect url dosen't have any context path then it is working fine. e.g. www.google.com.

Thanks,
Tushar
 
Pankaj Misra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please post your fully constructed URL, it will help debug the root cause.
 
tushar borole
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

The constructed url is

http://lnx1.domainname:20080/example/dologin?account=test1&password=test2&locale=en-US

The above url is not working when I am passing it to sendRedirect().

But if I re-enter the same url in same window or another window it is perfectly working.

Do you have any pointers to resolve this.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you tried using the method encodeRedirectURL and return type of it into sendRedirect()??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic