If you use Spring Security you can also check against the SecurityContext. Regards, Otho
2008/12/11 Allex Juang <[EMAIL PROTECTED]> > Thanks Peter, It works. > > Allex J. > > Peter Stavrinides 提到: > >> Use an application state object (it is session scoped), so on your login >> page you could have: >> >> @ApplicationState >> private UserStateTracker stateTracker; >> >> @InjectPage >> private Home homePage; >> >> Object onActivate(){ >> if(stateTracker.isSignedIn()){ >> //user is already signed in so redirect >> return homePage; >> } >> } >> >> >> If you need something slightly more complex (i.e.:filtering per request) >> then you need to implement a request filter and do the checking there: >> >> public class PageAccessController implements RequestFilter { >> >> public PageAccessController(ApplicationStateManager asm) { >> asm_ = asm; >> } >> >> public boolean service(Request request, Response response, >> RequestHandler handler) throws IOException { >> UserStateTracker stateTracker = >> asm_.get(UserStateTracker.class); >> >> if(!stateTracker.isSignedIn()) >> //user is not signed in so redirect him to the login page >> >> } >> >> >> } >> >> You also will need a contribution in your AppModule: >> public static void contributeRequestHandler( >> OrderedConfiguration<RequestFilter> configuration, >> @InjectService("TimingFilter") RequestFilter >> filter, @InjectService("PageAccessController") >> RequestFilter pageAccessController) { >> configuration.add("Timing", filter); >> configuration.add("PageAccessController", >> pageAccessController, >> "before:PageRender"); >> } >> >> cheers, >> Peter >> >> ----- Original Message ----- >> From: "Allex Juang" <[EMAIL PROTECTED]> >> To: "Tapestry users" <users@tapestry.apache.org> >> Sent: Wednesday, 10 December, 2008 9:31:29 AM GMT +02:00 Athens, Beirut, >> Bucharest, Istanbul >> Subject: Redirect before page render >> >> Hi, >> >> I have a Login page, and user will navigate to, say, Work page after >> success authenticate process. >> But when an authenticated user access Login page, I wish to just redirect >> to Work page. >> How can I do that? >> >> Allex J. >> >> --------------------------------------------------------------------- >> 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] >> >> >> __________ NOD32 3680 (20081210) Information __________ >> >> This message was checked by NOD32 antivirus system. >> http://www.eset.com >> >> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >