问题
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