You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edvin Syse <ed...@sysedata.no> on 2008/05/07 10:09:13 UTC
Re: Immediate redirect from session
Johan Compagner wrote:
>
> 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
>
OK. By mistake I didn't see your answer, and I just tried with Martijn's
RedirectToExternalException and it worked :) I'll try to understand more of
the low level processes of Wicket so I don't put code in strange places
anymore :) hehe Thanks!
Edvin Syse wrote:
>
> On 4/28/08, Edvin Syse <ed...@sysedata.no> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
View this message in context: http://www.nabble.com/Immediate-redirect-from-session-tp16946073p17099661.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org