简体   繁体   中英

Rest @PathParam doesn't work

I'm working on a REST web service using CXF. I have published my web service and it's working fine except for the following method, which requires a parameter:

@GET
@Path("/capteur/{id}")  
public Capteur selectCapteurByID(@PathParam(value = "id")String id) {
System.out.println(id);
return capteurDao.getCapteur(id);
}

When I try to access my service using the URL: localhost:8080/FireApp/rest/myService/myservice/capteur/11554

I get no response and the following log message:

DEBUG o.a.cxf.ws.addressing.ContextUtils - WS-Addressing - failed to retrieve Message Addressing Properties from context

WS-Addressing is rather specific to JAX-WS/SOAP stuff and not the RESTful JAX-RS.

Are you sure your not mixing JAX-WS (@WebService) with JAX-RS in your class ?

您必须将端点注释为@Path而不是@WebService,才能使其适用于REST端点。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM