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

你。 提交于 2019-12-20 02:39:18

问题


I want to export a Web-Service which was implemented as a stateless EJB. I know that these WebServices were hanled by the EJB Container, when they are annotated as @Stateless + @Webservice. Is it possible to route all incoming requests to this Webservice through a Servlet-Filter.

The Servlet-Filter works when my Java-Class is annotated @Stateful and @Webservice, or just @Webservice. But not in conjunction with @Stateless. Anyway to register a Servlet Filter for an EJB Webservice?

Many thanks!

Adem

UPDATE: Solved this problem, by annotating WebService Class with

@WebService
@RequestScoped

Filter works only in this constellation and acting as Stateless class for WebService consumer.


回答1:


  • Lifecycle Callbacks : You can have a method with @PostConstruct annotation which gets called after the container has initialized the bean.

  • Interceptor : You can have a interceptor class which gets invoked when applied at bean class/method level by annotation @Interceptors(ProcessMonitor.class).

Note : I haven't tried it in conjunction with @Webservice.



来源:https://stackoverflow.com/questions/9702793/is-it-possible-to-define-a-servlet-filter-for-a-stateless-ejb-webservice-on-gla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!