aspose file tools
The moose likes Struts and the fly likes Urgent!! How can I forward from http to https by using ActionForward in Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Urgent!! How can I forward from http to https by using ActionForward in Struts?" Watch "Urgent!! How can I forward from http to https by using ActionForward in Struts?" New topic
Author

Urgent!! How can I forward from http to https by using ActionForward in Struts?

Henry Sun
Greenhorn

Joined: May 09, 2003
Posts: 18
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
Josh Landin
Greenhorn

Joined: Jun 09, 2003
Posts: 10
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):

Then in your web.xml add:

Now requests attempting to access http://myserver/members/* will be automatically tranformed to https://myserver/members/*
Make sure you have a SSL connector configured in your container to handle https connections properly.
HTH,
--
Josh
Henry Sun
Greenhorn

Joined: May 09, 2003
Posts: 18
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Urgent!! How can I forward from http to https by using ActionForward in Struts?
 
Similar Threads
Actionforward url
urgent
URGENT !!!!
[URGENT]Problems with Struts and Tiles
switching between http and https protocols