简体   繁体   English

休息@PathParam不起作用

[英]Rest @PathParam doesn't work

I'm working on a REST web service using CXF. 我正在使用CXF开发REST Web服务。 I have published my web service and it's working fine except for the following method, which requires a parameter: 我已经发布了我的Web服务,除了以下需要参数的方法以外,它都可以正常工作:

@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 当我尝试使用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. WS-Addressing特定于JAX-WS / SOAP,而不是RESTful JAX-RS。

Are you sure your not mixing JAX-WS (@WebService) with JAX-RS in your class ? 您确定在您的课程中没有将JAX-WS(@WebService)与JAX-RS混合吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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