how to intercept JSF managed bean method

Splash Forums Rewrite Users how to intercept JSF managed bean method

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  xuzhike 5 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18099

    xuzhike
    Participant

    Hi, All,

    I want to log JSF managed bean “Action” method execution time. how do I implement the interceptor?

    I referenced SocialPM’s ResponseTimeLoggingFilter, but it seems not meet my requirement completelly.

    please advise.

    thx a lot

    #21713

    This depends on the frameworks that you use. If you are using CDI you could use a standard interceptor for this job. With Spring you could use the AOP module for something similar.

    You could also implement a JSF PhaseListener and use it to log the execution time of individual JSF phases. That’s what I always do to get a general impression on the overall performance behavior of my application.

    #21714

    xuzhike
    Participant

    Hi, Christian,

    Thanks for your idea.

    my application bases on JSF2+Spring3. I tried to integrate CDI with Spring/JSF.

    but seems it not work to inject Spring’s Service into JSF Managed Bean ( I want to use CDI in JSF Bean, Spring’s annotation in Service/Dao).

    if use Spring AOP module, seems JSF managed bean should be managed by Spring.

    #21715

    In a typical application setup you will probably use either CDI or Spring and no JSF managed beans at all. Is there any reason you are using JSF managed beans for the view and Spring for the Dao/Services? Why not use Spring for everything? See:

    http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/web-integration.html#jsf

    Than you could measure the execution time for methods executed more or less easily using Spring AOP.

    #21716

    xuzhike
    Participant

    you are right. I should use Spring to manage everything.

    I just tried to integrate everything to see if it works.

    thx

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.