Urgent!! How can I forward from http to https by using ActionForward in Struts?
Joined: May 09, 2003
Hi, there, I'm developing a website including http and https protocols. On my login page, I have a button which will call doSigninAction. In this action class, according to the result of authentication, I will get the ActionForward from struts-config.xml. My problem is, mapping.findForward() can only get the relative path which does not include http or https. But I need to forward my request from http to https in this action. How can I do it? I've searched in this forum, nobody seems giving answers for such question. I think Struts should have some mechanism to handle such cases. Any advice will be very helpful. It is urgent for me 'cause the project deadline is coming. Thanks in advance. henry
Joined: Jun 09, 2003
How about adding a security-constraint for that ActionForward in your deployment descriptor. For example, if your "doSigninAction" needs to forward the authenticated user to a forward like:
And you want that destination to be https, then first you'll need the forward to be a redirect (this way the https connection is between the client and the server running through all defined security constraints):
Hi, Josh, Thanks for your response. I am not sure whether this method can work. But actually I am working in a different senario. I am using Apache+JBoss servers and I have installed SSL into Apache server. I think your method may work if I install SSL into tomcat or jboss server, is it true? So in my senario, what I want is just getting a absolute path in ActionForwad(which should include https://). Do you have any any idea to resolve this problem with an easy way? Thanks henry