Results 1 to 4 of 4

Thread: how to proxy a single class using aop

  1. #1

    Default 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. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    DelegatingFilterProxy might be of help.

    Jörg

  3. #3

    Default

    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

  4. #4
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote 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.

    Quote 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •