[英]Apache CXF DSOGI on Karaf + @Context UriInfo
I am trying to create a RESTful web service in Karaf 4.0.8 with Apache CXF DOSGI. 我正在尝试使用Apache CXF DOSGI在Karaf 4.0.8中创建RESTful Web服务。 I am trying to add @Context
in my implementation. 我正在尝试在实现中添加@Context
。 How to do it? 怎么做?
@Component(immediate = true, property = {
"service.exported.interfaces=*",
"service.exported.configs=org.apache.cxf.rs",
"org.apache.cxf.rs.provider=com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider",
"org.apache.cxf.rs.address=/integr" })
public class AccountRestService implements AccountWebUserIdResource {
@Context
private UriInfo context;
...
}
UriInfo
is not getting injected properly. UriInfo
没有正确注入。
REST API Interface you need to add your @Context
您需要添加@Context
REST API接口
@GET
@Path("{memberid}")
@Produces({"application/json"})
MembersResource.GetMembersByMemberidResponse getMembersByMemberid(
@PathParam("memberid") String memberid,@QueryParam("fields") String fields,
@Context javax.ws.rs.core.UriInfo uriInfo) throws Exception;
@Path("{memberid}")
@GET
@Path("{memberid}")
@Produces({"application/json"})
MembersResource.GetMembersByMemberidResponse getMembersByMemberid(
@PathParam("memberid") String memberid,@QueryParam("fields") String fields,
@Context javax.ws.rs.core.UriInfo uriInfo) throws Exception;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.