2013-04-10 81 views
1

好了,不知何故,我觉得愚蠢,一定是有什么明显的我失踪...的Apache CXF REST服务与字节范围参数/ MessageContext的

我使用Apache CXF(2.7.x)的宁静该服务包含一种检索某些视频数据的方法。某些客户端需要能够使用字节范围进行请求。首先我需要知道的是客户端实际请求的字节范围,所以我想我会看看http标头。 据我了解所有我应该需要做的是能够做到这一点的就是把MessageContext中作为一种资源在我的服务类:

@Resource 
MessageContext ctx; 

问题是,这种失败,因为没有这样的bean:

Injection of resource dependencies failed; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: 
No matching bean of type [org.apache.cxf.jaxrs.ext.MessageContext] found for dependency 

在我的春天配置我有这些包括:

<import resource="classpath:META-INF/cxf/cxf.xml"/> 
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> 

某处,我读了CXF波及JAXRS-binding.xml不再需要,而据我硝酸钾w,这个文件甚至不存在于我的依赖中的任何地方。

那么我在这里错过了什么? 还有另一种支持字节范围请求的方法吗?

回答

0

好,与

MessageContext ctx = new MessageContextImpl(PhaseInterceptorChain.getCurrentMessage()); 

我不知道这是一个很好的解决方案解决了这个问题,但它的作品。