簡體   English   中英

用空路徑參數調用REST URL

[英]calling the REST url with empty path param

服務器:Wildfly 8

REST軟件包:javax.ws.rs。*

嘗試使用http://localhost:8070/RestSample-war/rest/bean/getall/sam訪問以下rest服務時,它可以正常工作,但是嘗試使用空路徑參數時,例如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/

能請您刪除空白嗎

@Path("getall/{name:.*}")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM