1 Reply Latest reply on Feb 23, 2004 10:24 AM by Paul Robinson

    Custom client interceptor

    Anton Newbie

      Hi all!

      I have the following question:
      Can I re-invoke method in client interceptor?

      For example:

      public class TestInterceptor extends Interceptor {

      public Object invoke(final Invocation mi) throws Throwable
      {
      while(true) {
      try {
      return getNext().invoke(mi);
      }
      catch (SomeException e)
      {
      ...
      }
      }
      }

      }

      So, I want to handle SomeException in the TestInterceptor, to make SomeException invisible to the client.
      Can I do this? And how? Should I set transaction or security context again before repeating method call?
      Help me please!

        • 1. Re: Custom client interceptor
          Paul Robinson Master

          Hello,

          I may have the wrong end of the stick, but can't you just re-call the invoke method:

          public class TestInterceptor extends Interceptor {

          public Object invoke(final Invocation mi) throws Throwable
          {
          try
          {
          return getNext().invoke(mi);
          }
          catch (SomeException e)
          {
          invoke(mi);
          }
          }

          You wouldn't need the while loop this way.

          Hope this helps,

          Paul Robinson