5 Replies Latest reply: Mar 15, 2012 12:12 PM by LG . RSS

    Message Interceptor & Filters ... HELP !!

    Willy Cornejo

      Hi everibody,

      Im trying to create a Custom Message Interceptor but I have several Problems:

      1. On the admin console when I add my Class called LikesInterceptor, I just able to see the word "null" intead of LikesInterceptor.

      2. When I turn on the  Message Interceptor of step 1, and try to add a new message respoponse I got an exception:

       

      java.lang.reflect.InvocationTargetException

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:358) ....

       

      My Code is:

       

      public class LikesInterceptor implements MessageInterceptor {
        public LikesInterceptor() {
          super();
        }
        public LikesInterceptor(int objectType, long objectID) {
          super();
        }
        public int getType() {
          return MessageInterceptor.TYPE_ALL;
        }

        public void invokeInterceptor(ForumMessage forumMessage, int i) throws MessageRejectedException {
          try {
            if (forumMessage.getBody() != null) {
              forumMessage.setBody(forumMessage.getBody() + "<br/><a href='#' ><b>Me Gusta...</b></a>"); 
               }           
          }
          catch (Exception e) {
            System.out.println("Fail: " + e.getMessage());
          }   
        }
      }

      Steps I follow:

      A. Create the LikesInterceptor.java class and LikesInterceptorBeanInfo.java and generate the JAR file

      B. Open the owc_discussions.ear and extract owc_discussions.war

      C. Open owc_discussions.war and copy the jar file into Lib folder.

      D. Update owc_discussions.war

      E. Update owc_discussions.ear with the owc_discussions.war updated

      F. Redeploy owc_discussions.ear

      G. Add the new messageinterceptor class into the list of Interceptors

      H. Activate the interceptor

      I. Add a new message In order to test the new interceptor.

       

      Jive version: Jive Forums Silver 5.5.20 .3

       

      Hope you can Help me... Thanks you very much!!!

       

      Willy