Hi Eric,
i think the best way to do it is to contrib to the Request handler pipilene
(http://tapestry.apache.org/tapestry5/tapestry-core/guide/request.html)
To contrib to a pipeline do it your AppModule:

public RequestFilter buildTimingFilter(final Log log) {
   return new RequestFilter() {
       public boolean service(Request request, Response response,
           RequestHandler handler) throws IOException {
       long startTime = System.currentTimeMillis();
       try {
           // The reponsibility of a filter is to invoke the
           // corresponding method
           // in the handler. When you chain multiple filters
           // together, each filter
           // received a handler that is a bridge to the next
           // filter.
           return handler.service(request, response);

       } finally {
           long elapsed = System.currentTimeMillis() - startTime;
           log.info(String.format("Request time: %d ms", Long.valueOf
(elapsed)));
       }
       }
   };
   }


   /**
    * This is a contribution to the RequestHandler service configuration.
    * This is how we extend Tapestry using the timing filter. A common use
    * for this kind of filter is transaction management or security.
    */
   public void contributeRequestHandler(OrderedConfiguration<RequestFilter>
configuration, @InjectService("TimingFilter") RequestFilter filter) {
   // Each contribution to an ordered configuration has a name, When
   // necessary, you may
   // set constraints to precisely control the invocation order of the
   // contributed filter
   // within the pipeline.
   configuration.add("Timing", filter);
   }



On 5/11/07, Eric Chatellier <[EMAIL PROTECTED]> wrote:

hi everyone

I'm starting using Tapestry 5.0.4 and i'm tying to implement an
authentication filter.


In some tapestry 4 samples, code was :

public abstract class AuthenticatedPage implements PageValidateListener {

        public void pageValidate(PageEvent event) {

                if (!isSessionBeanExist() ||
getSessionBean().getUid()==-1) {
                        Login loginPage = (Login)getRequestCycle()

                 .getPage("Login");

                        loginPage.setCallback(new PageCallback(this));

                        throw new PageRedirectException(loginPage);
                }
        }
}

public class ProjectList extends AuthenticatedPage {
  [...]
}

but i can't find the way to do it in tapestry 5.

thanks in advance for help, and sorry for my bad english ;)

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


Reply via email to