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]

Reply via email to