休息@PathParam不起作用

时间:2014-07-01 20:49:31

标签: java spring web-services rest cxf

我正在使用CXF开发REST Web服务。我已经发布了我的Web服务并且它工作正常,除了以下方法,它需要一个参数:

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

当我尝试使用以下网址访问我的服务时:localhost:8080/FireApp/rest/myService/myservice/capteur/11554

我没有得到回复和以下日志消息:

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

2 个答案:

答案 0 :(得分:0)

WS-Addressing特定于JAX-WS / SOAP的东西,而不是RESTful JAX-RS。

你确定你的班级中没有将JAX-WS(@WebService)与JAX-RS混合使用吗?

答案 1 :(得分:0)

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