On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Setting response header in site precontroller

We are having an interesting challenge.  One of our requirements for a new site is to allow for people to "sign in" (it not really signing in but that's the easiest way of explaining it) and stay signed in for up to seven (7) days.  To do this we are dropping a cookie on the workstation with an expiration of 7 days.  

 

  That works great.

 

  Here's the challenge - in the site controller we check to see if the cookie is valid and if it is, set the "isLoggedIn" to "True".  That works great.

 

   Here's the challenge,  LiveSite assumes that a new session can't be signed in.  So it decides to display the site's login page BEFORE calling the site precontroller.  In our case the person could still be considered logged in even though there is a new session.  

 

   I would love to fix this, but one option is to refresh the page login page if the person should be considered logged in and the session is new.

 

    Question - how to refresh the page from within a site precontroller?

 

    We've tried:

 

        HttpServletResponse response = context.getResponse();

        response.setHeader("Refresh", "0");

- and -

        context.setRedirectUrl("#");

 

    Both without success.