Doing this stuff in the session constructor is really the wrong place,
then still the normal request processing will happen.

Something like this should be done in RequestCycle.onBeginRequest()
and then throw a RestartResponseException() instead of just setting a
request target.

Johan

On 4/28/08, Edvin Syse <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a CMS-system that under some circumstances should do an immediate
> redirect when the session is created. I try with the following code
> in MySession's constructor:
>
> String host = ((ServletWebRequest)
> request).getHttpServletRequest().getHeader("host");
> Instance instance = instanceDao.findByHostname(host);
>
> if(!Strings.isEmpty(instance.getHost().getRedirectToHost())) {
>       String redirectUrl = instance.getHost().getRedirectToHost();
>       
>       if(instance.getHost().getKeepParamsOnRedirect())
>               redirectUrl = redirectUrl + "/" + request.getPath();
>
>       RequestCycle.get().setRedirect(true);
>       RequestCycle.get().setRequestTarget(new
> RedirectRequestTarget(redirectUrl));
>                       
>       return;
> }
>
> After this is run, I would like Wicket to just do the redirect, but instead
> it goes through the authorizationStrategy and returns the page
> that my RequestCycleProcessor picks out.
>
> Is there a way to do an _immediate_ redirect, or discard the page that my
> RequestCycleProcessor has already picked out?
>
> -- Edvin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to