• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

switching to HTTPS

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,

I am trying to switch from 'http' request to 'https' after successful registration process.
In my struts-config file, I have something like this -


In my RegistrationAction.java, I have the following -


public ActionForward doExecute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws Exception {
// stuff1...
// stuff2...

return actionMapping.findForward("success");
}


I have a method that can generate the 'https' URL (as String) based on actionForward. But I am not sure as to how can I use this in my ActionClass as the ActionClass must return actionForward...

Any help on this is much appreciated.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also create an ActionForward from a constructor. Here's an example of what you might do:


[ November 13, 2007: Message edited by: Merrill Higginson ]
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Merrill for your prompt and useful reply!

But I guess, I am stuck in the myMethodThatTransformsToSSL(regularURL) method! I assumed that I'd be able to construct the entire URL by using the methods in the request object (like getRequestURL or something) but I am not able to get this working with the tiles definition.

Could you let me know how do I set up the URL with 'https' and forward/redirect it to the content page of tiles definition?

I came across the sslext library (from sourceforge) but since our application already is in alpha testing, I didnt want to go that route...
[ November 13, 2007: Message edited by: Bhaskar Reddy ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you're changing protocols (http to https) you must redirect to a new URL rather than simply forwarding to it. Since you're using tiles, this means redisplaying the tiles template. Since the current request is only for the current page fragment, I don't know of a way to dynamically get the name of the tiles template being displayed. You may have to hard code it.

I'd still get the server portion of the URL using the reqeust.getRequestURI() method. Then change http to https and plug in the tiles template.
 
It's a tiny ad. At least, that's what she said.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic