簡體   English   中英

澤西編碼的字符串,因為未傳遞@pathParam資源

[英]jersey encoded string as @pathParam resource is not passed

我有一個定義的資源:

@Path("/customer/{customerId}")
@Consumes(MediaType.APPLICATION_JSON)
public Response getLocationsByAccount( @QueryParam("page") Integer page,
                                      @QueryParam("per_page") Integer pageSize,,@PathParam(value = "customerId") String customerId);

當我嘗試做的時候:

 curl 'http://localhost:8080/path/customer/1?page=1%26per_page=100'

一切正常。

現在,我想將customerID作為編碼值獲取,這意味着:

curl 'http://localhost:8080/path/customer/jgLiFuOi%2F0dTMbssRcfNvQ%3D%3D?page=1&per_page=22'

我越來越找不到資源。

我究竟做錯了什么 。

這對我在Glassfish上有效:

@Path("path")
public class Resource {
  @GET
  @Path("/customer/{customerId}")
  public String getLocationsByAccount(@QueryParam("page") Integer page,
        @QueryParam("per_page") Integer pageSize,
        @PathParam(value = "customerId") String customerId) {
    return customerId;
  }
}

請求:

curl --noproxy localhost, "http://localhost:8080/path/customer/jgLiFuOi%2F0dTMbssRcfNvQ%3D%3D?page=1&per_page=22"

響應:

jgLiFuOi/0dTMbssRcfNvQ==

因此,看起來您做錯了什么。

暫無
暫無

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

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