CXF 继续
如何从 JAXRS ServiceEndpoint serviceBean 或 JAXWS ServiceEndpoint serviceBean 获取 org.apache.cxf.continuations.Continuation。
我的 spring 配置看起来像这样。
<bean id="myServiceContainer" class="cxfutils.endpoint.soap.JAXWSServiceEndpoint">
<property name="serviceBean" ref="myReceiver" />
</bean>
对于 jaxrs 它看起来像你应该添加
import org.apache.cxf.continuations.ContinuationProvider;
import org.apache.cxf.jaxrs.ext.MessageContext;
import javax.annotation.Resource;
import org.apache.cxf.continuations.Continuation;
@Resource
private MessageContext context;
@GET
@Path("hello")
@Produces("text/plain")
public String hello(@Context final HttpServletRequest httpRequest){
ContinuationProvider provider = (ContinuationProvider)context.get(ContinuationProvider.class.getName());
Continuation conti = provider.getContinuation();
...
}
How to get a org.apache.cxf.continuations.Continuation from a JAXRS ServiceEndpoint serviceBean or JAXWS ServiceEndpoint serviceBean.
My spring config look like that.
<bean id="myServiceContainer" class="cxfutils.endpoint.soap.JAXWSServiceEndpoint">
<property name="serviceBean" ref="myReceiver" />
</bean>
for jaxrs it seam like you should add
import org.apache.cxf.continuations.ContinuationProvider;
import org.apache.cxf.jaxrs.ext.MessageContext;
import javax.annotation.Resource;
import org.apache.cxf.continuations.Continuation;
@Resource
private MessageContext context;
@GET
@Path("hello")
@Produces("text/plain")
public String hello(@Context final HttpServletRequest httpRequest){
ContinuationProvider provider = (ContinuationProvider)context.get(ContinuationProvider.class.getName());
Continuation conti = provider.getContinuation();
...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 JAXWS,需要从 WebServiceContext.getMessageContext() 找到 JAXWS MessageContext。
然后你可以在 MessageContext 上调用 context.get()
in the case of JAXWS the JAXWS MessageContext need to be found from WebServiceContext.getMessageContext().
you can then call context.get() on the MessageContext