Announcement Announcement Module
Collapse
No announcement yet.
how to proxy a single class using aop Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to proxy a single class using aop

    I have a web.xml which does the following
    Code:
    <listener>
            <listener-class>com.common.LoadImage</listener-class>
        </listener>
    My LoadImage is something like this
    Code:
    public class LoadImage implements ServletContextListener {
        private ServletContext context = null;
    
        public void contextDestroyed(ServletContextEvent event) {
    
        }
    
        public void contextInitialized(ServletContextEvent event) {
           //some code
        }
    }
    I have an intercepter that logs messages which states the time take to execute the method.

    How do i proxy all methods in this class.

    For my beans in applicationContext.xml i use ProxyFactoryBean and it works fine, but this class is not Injected, hence not sure how to proxy it in applicationContext.xml. I would like to do it in applicationContext.xml as I have one version which is solely for finding perf and other version which is for production.

    Thanks

  • #2
    DelegatingFilterProxy might be of help.

    Jörg

    Comment


    • #3
      Thanks for the reply, But DelegateFilterProxy is for filters right, how can i apply this to listeners. Also I have other classes which are not injected by spring and hence don't appear in applicationContext.xml how do I proxy those classes.

      Thanks again

      Comment


      • #4
        Originally posted by muthiahmerchant View Post
        But DelegateFilterProxy is for filters right
        Ehm, sorry. Should not try to be helpful after midnight - oh, same time again

        I'm not aware of any solution for that particular problem then. Maybe you describe your actual problem a bit that you want to try to solve. Proxying a listener sounds not that useful.

        Originally posted by muthiahmerchant View Post
        Also I have other classes which are not injected by spring and hence don't appear in applicationContext.xml how do I proxy those classes.
        You can still proxy them programmatically.

        Jörg

        Comment

        Working...
        X