服务器:Wildfly 8
REST包:javax.ws.rs。*
尝试访问以下休息服务时使用
http://localhost:8070/RestSample-war/rest/bean/getall/sam
它工作正常,但尝试使用空路径参数
http://localhost:8070/RestSample-war/rest/bean/getall/
,它会抛出错误
@GET
@Path("getall/{name: .*}")
@Produces("application/json")
public Object Getall(@PathParam("name") String customerName) {
if(customerName !=null){
//return specific customer detail
}else{
//return all customer detail
}
}
错误:
17:18:04,637 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-37)
failed to execute: javax.ws.rs.NotFoundException: Could not find resource for
full path: http://localhost:8070/RestSample-war/rest/bean/getall/
答案 0 :(得分:0)
请你尝试删除空白
@Path("getall/{name:.*}")