我正在尝试使用Apache CXF DOSGI在Karaf 4.0.8中创建RESTful Web服务。我想在我的实现中添加@Context
。怎么做?
@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
未正确注入。
答案 0 :(得分:0)
您需要添加@Context
@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;