aspose file tools*
The moose likes Servlets and the fly likes response.sendRedirect(Url) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "response.sendRedirect(Url)" Watch "response.sendRedirect(Url)" New topic
Author

response.sendRedirect(Url)

masnif bla
Greenhorn

Joined: Nov 05, 2007
Posts: 3
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

Joined: Mar 08, 2007
Posts: 1585
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 ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
masnif bla
Greenhorn

Joined: Nov 05, 2007
Posts: 3
Nope, it doesnt work out...
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
What did you exactly do ?
masnif bla
Greenhorn

Joined: Nov 05, 2007
Posts: 3
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

Joined: Oct 11, 2004
Posts: 3830
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

Joined: Nov 11, 2007
Posts: 3
Originally posted by ankur rathi:


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


Hey, i don't think so..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41818
    
  62
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response.sendRedirect(Url)