You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by ha...@welinux.cl on 2009/11/02 20:28:04 UTC

Redirect some users to custom handlers

Hi,

I have a common url: home.htm, that i can't change, it always go to a specific click page handler.

In this page there are some users that i need to redirect to a custom page depending on the user type. I tried setting redirect and forward in the onInit() method and then returning, but i doesn't work.

Looking at click servlet code, i've noticed it's not checking if in the onInit() method there are redirects or forwards setted.

Is there some specific way to achieve this with click without writing filters.

Thanks
Hans

Re: Redirect some users to custom handlers

Posted by Bob Schellink <sa...@gmail.com>.
Hi Hans,

onSecurityCheck is a good place for this sort of stuff. Note that Click will respect the 
forward/redirect you set in onInit when rendering the page. See this Page execution flow diagram for 
  detail:

http://incubator.apache.org/click/docs/user-guide/html/ch02s02.html#activity-diagram

kind regards

bob

hans@welinux.cl wrote:
> Hi,
> 
> Responding to myself, i made it work: 
> 
> Override onSecurityCheck, set the Forward page to the page you like to go (Not Redirect) and then return false.
> 
> Hans
> 
> ----- hans@welinux.cl escribió:
> 
>> Hi,
>>
>> I have a common url: home.htm, that i can't change, it always go to a
>> specific click page handler.
>>
>> In this page there are some users that i need to redirect to a custom
>> page depending on the user type. I tried setting redirect and forward
>> in the onInit() method and then returning, but i doesn't work.
>>
>> Looking at click servlet code, i've noticed it's not checking if in
>> the onInit() method there are redirects or forwards setted.
>>
>> Is there some specific way to achieve this with click without writing
>> filters.
>>
>> Thanks
>> Hans
> 


Re: Redirect some users to custom handlers

Posted by ha...@welinux.cl.
Hi,

Responding to myself, i made it work: 

Override onSecurityCheck, set the Forward page to the page you like to go (Not Redirect) and then return false.

Hans

----- hans@welinux.cl escribió:

> Hi,
> 
> I have a common url: home.htm, that i can't change, it always go to a
> specific click page handler.
> 
> In this page there are some users that i need to redirect to a custom
> page depending on the user type. I tried setting redirect and forward
> in the onInit() method and then returning, but i doesn't work.
> 
> Looking at click servlet code, i've noticed it's not checking if in
> the onInit() method there are redirects or forwards setted.
> 
> Is there some specific way to achieve this with click without writing
> filters.
> 
> Thanks
> Hans

-- 
Hans Poo, WeLinux S.A. http://www.welinux.cl
Oficina: 697.25.42, Celular: 09-319.93.05
Bombero Ossa # 1010, Santiago