• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

switching to HTTPS

 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic