Is it possible to define a servlet filter for ejb stateless web service, on GlassFish 3.1

I want to export a web service that has been implemented as a stateless E-GATE. I know these WebServices have been processed by the EJB container when annotated as @Stateless + @Webservice. Is it possible to route all incoming requests to this web service through a servlet filter.

Servlet-Filter works when my Java class is annotated with @Stateful and @Webservice or just @Webservice. But not in conjunction with @Stateless. Is there anyway to register a servlet filter for an EJB web service?

Many thanks!


UPDATE: Solving this issue by annotating the WebService class with



The filter only works in this constellation and acts like a Stateless class for the WebService consumer.


source to share

1 answer

  • Lifecycle callbacks: You can have an annotated method that gets @PostConstruct

    called after the container has initialized the bean.

  • Interceptor: You can have an interceptor class that is called when applied at the class / method level of the bean via annotation @Interceptors(ProcessMonitor.class)


Note. I have not tried it in combination with @Webservice




All Articles