You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Gurkan Erdogdu <cg...@gmail.com> on 2009/07/15 18:10:07 UTC

Interceptors in Tomcat

Hi;

I am trying to getting work of interceptors in Tomcat installation.

I have a simple stateless Bean

@Stateless
@Interceptors(value={MyInterceptor.class})
public class HelloBean implements Hello
{
    public String sayHello()
    {
        return "Hello";
    }
}

This is MyInterceptor

public class MyInterceptor
{
    @PostConstruct
    public void afterConstruct(InvocationContext context) throws Exception
    {
        Object object = context.getTarget();

        System.out.println(object);

    }

    @AroundInvoke
    public Object arounfInvoke(InvocationContext context) throws Exception
    {
        return context.proceed();
    }
}

But interceptors are not called. If I debug, in DeploymentInfo instance,
InterceptorData exist with class MyInterceptor, but its post construct and
around invoke method lists are empty.

Is there anything that I missed?

Thanks;

--Gurkan