I think UriInfo.getPath() (accessible via @javax.ws.rs.core.Context) is what you're looking for.

Glen

On 04.01.2011 02:29, mike wrote:
Hi,

is it possible to get the value of a @Path annotation in the cxf client?

What i have is:

Webservice Interface:
@Path("/RegistrationService")
@Consumes( { "application/xml" })
@Produces( { "application/xml" })
public interface RegistrationService {
        
        @POST
        @Path("/user/register")
        public void register(RegistrationData registrationData);
}

Client-Side Implementation:
public class RegistrationServiceImpl implements RegistrationService {
        
        private RegistrationService service;
        private Client client;
        
        public RegistrationServiceImpl() {

                // create proxy
                this.service = JAXRSClientFactory.create("http://localhost";,
RegistrationService.class);
                
                // convert proxy to client (acts then like a browser)
                this.client =
WebClient.client(this.service).accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);

        }
        
        @Override
        public void register(final RegistrationData registrationData) {

                String path = ??? // path should be "/user/register"

                registrationData.setMessageId(createMessageId(path,
registrationData.getMail()));
                
                this.service.register(registrationData);
                
        }
}

does cxf offer a way to get that path value or do i have to get it with
reflection?

Thanks in advance
mike


--

Glen Mazza
gmazza at apache dot org
http://www.jroller.com/gmazza

Reply via email to