Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect(Url)

 
masnif bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to redirect to a url within my servlet with the parameters
e.g
String url = https://www.thirdparty.com/?login=loginName&passwd=passwd

response.sendRedirect(Url)

When i use the same url in <a href> , it works fine and the user gets authenticated also, but when i use response.sendRedirect, it gets redirected to the url but the authentication fails.
Can you please let me know if there is something i can do to get it working
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Take a look at the security tags that can be embedded inside the web.xml file, especially the <user-data-constraint> and <transport-guarantee> tags.

Best of luck ...
 
masnif bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, it doesnt work out...
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you exactly do ?
 
masnif bla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made the following entries in web.xml

<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>

<user-data-constraint>
<transport-guarantee>INTEGRAL</transport-guarantee>
</user-data-constraint>

</security-constraint>
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by masnif bla:
I am trying to redirect to a url within my servlet with the parameters
e.g
String url = https://www.thirdparty.com/?login=loginName&passwd=passwd

response.sendRedirect(Url)

When i use the same url in <a href> , it works fine and the user gets authenticated also, but when i use response.sendRedirect, it gets redirected to the url but the authentication fails.
Can you please let me know if there is something i can do to get it working


I think, you can't pass parameters while redirecting.
 
Andrew liu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ankur rathi:


I think, you can't pass parameters while redirecting.


Hey, i don't think so..
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but the authentication fails

How is authentication handled - does it take URL parameters into account? If you're using container-managed security (which is based on the login-config and auth-constraint elements, by the way, not user-data-constraint) you won't be able to log in automatically in this way.

I think, you can't pass parameters while redirecting.

Yes, you can.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic