-
1. Re: Client-interceptor
vummarao Aug 26, 2007 5:20 PM (in response to vummarao)I could get it to work by making these changes.
Is this the right way??
//ClientInterceptor
package com.acme.ejb;
import java.io.Serializable;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.util.PayloadKey;
public class AcmeOPClientInterceptor implements Interceptor, Serializable
{
public String getName()
{
return "AcmeClientInterceptor";
}
public Object invoke(Invocation invocation) throws Throwable
{
invocation.getMetaData().addMetaData("TEST", PayloadKey.MARSHALLED, "IDDD");
return invocation.invokeNext();
}
}
//ServerInterceptor
package com.acme.ejb;
import java.io.Serializable;
import java.util.Date;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.metadata.SimpleMetaData;
import org.jboss.aop.util.PayloadKey;
public class AcmeServerInterceptor implements Interceptor, Serializable
{
public String getName()
{
return "AcmeServerInterceptor";
}
public Object invoke(Invocation invocation) throws Throwable
{
SimpleMetaData sm = invocation.getMetaData();
Object o = invocation.getMetaData("TEST",PayloadKey.MARSHALLED));
return invocation.invokeNext();
}
}
Add client interceptor to StatelessSessionClientInterceptors to ejb3-interceptors-aop.xml
<interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
<interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
<interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
<interceptor-ref name="com.acme.ejb.AcmeClientInterceptor"/>
<interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
for the domain name "Stateless Bean" add the interceptor
com.acme.ejb.AcmeServerInterceptor
to the bind pointcut="execution(public * *->*(..))"