0

I am trying to create a RESTful web service in Karaf 4.0.8 with Apache CXF DOSGI. I am trying to add @Context in my implementation. 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.

dur
  • 15,689
  • 25
  • 79
  • 125
  • Questions seeking debugging help ("**why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without a **clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Tatsuyuki Ishi Mar 28 '17 at 00:09

1 Answers1

0

REST API Interface you need to add your @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;