• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic