http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages
----- Original Message ---- > From: Jake Vang <vangj...@googlemail.com> > To: user@struts.apache.org > Sent: Sat, January 30, 2010 4:10:31 PM > Subject: interceptor is not being called for all action > > i have written an interceptor implementation, however, it seems i cannot get > it to work. i have followed the instructions at > http://struts.apache.org/2.x/docs/interceptors.html. i have also followed > the instructions at > http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto > use the interceptor with every action. > > however, when any of my actions run, i never see the pre and post processing > logging messages (logging messages inside the intercept method). i do see > the logging messages from the init and destroy methods. this is not a > problem with logging (as for sanity checking, i also use System.out.println, > and have Tomcat running in console mode). i also have placed some break > points in the intercept(ActionInvocation) method, but these break points are > never reached. > > this is my struts.xml. > > > > > > class="mypackage.DummyInterceptor"/> > > > > > > > > > > this is my DummyInterceptor class. > > public class DummyInterceptor implements Interceptor { > private static final Log _log = > LogFactory.getLog(DummyInterceptor.class); > public void destroy() { > _log.debug("dummy interceptor destroyed called"); > System.out.println("dummy interceptor destroyed > called".toUpperCase()); > } > public void init() { > _log.debug("dummy interceptor init called"); > System.out.println("dummy interceptor init called".toUpperCase()); > } > public String intercept(ActionInvocation actionInvocation) throws > Exception { > _log.debug("dummy interceptor intercept pre processing"); > System.out.println("dummy interceptor intercept pre > processing".toUpperCase()); > > String result = actionInvocation.invoke(); > > _log.debug("dummy interceptor intercept post processing"); > System.out.println("dummy interceptor intercept post > processing".toUpperCase()); > return result; > } > } > > i am using annotations for my Action classes, so i do not define any > elements in struts.xml (using the Struts2 Convention jar). > > one very interesting thing i did was to get struts-default.xml out of the > struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding: 1) a > definition of my interceptor and 2) my interceptor onto the defaultStack. > when i did this, my interceptor does work as expected (i see logging output > from the intercept method, i can hit break points set inside this method) > for all my actions. > > i wonder if there is some gotcha that i am missing here. is there something > extra that i have to do when mixing annotations with interceptors? > > thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org