可以在GlassFish 3.1上为无状态ejb webservice定义一个servlet过滤器 [英] Is it possible to define a servlet filter for a stateless ejb webservice, on GlassFish 3.1

查看:96
本文介绍了可以在GlassFish 3.1上为无状态ejb webservice定义一个servlet过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想导出实现为无状态EJB的Web服务。当我们注释为@Stateless + @Webservice时,我知道这些WebServices被EJB容器所笼罩。可以通过Servlet-Filter将所有传入的请求路由到此Webservice。

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.

当我的Java-Class注释为@Stateful和@Webservice时,Servlet-Filter可以工作,或者只是@Webservice。但不结合@Stateless。无论如何为EJB Webservice注册一个Servlet过滤器?

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?

非常感谢!

Adem

更新:
通过使用

UPDATE: Solved this problem, by annotating WebService Class with

@WebService
@RequestScoped

过滤器仅在此星座和作为WebService消费者的无状态类。

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

推荐答案


  • 生命周期回调:您可以方法与 @PostConstruct 注释在容器初始化bean之后调用。

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

      拦截器:你可以有一个拦截器类,当通过注释 @Interceptors(ProcessMonitor.class)在bean类/方法级别应用时调用该类。

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

      注意:我没有与 @Webservice 一起尝试。

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

      这篇关于可以在GlassFish 3.1上为无状态ejb webservice定义一个servlet过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆