[jboss-user] [EJB 3.0] - Re: Client-interceptor
vummarao
do-not-reply at jboss.com
Sun Aug 26 17:20:33 EDT 2007
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 * *->*(..))"
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078169#4078169
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078169
More information about the jboss-user
mailing list