![](/img/trans.png)
[英]Java RESTFUL-Service returns 500 Internal Server Error (jersey)
[英]500 glassfish internal error while calling restful service with % sign in URL
我在glassfish 3.2.1上遇到HTTP 500內部服務器錯誤,同時將%符號放入URL作為ledgerAccountNumber。
Sample url - https://domain:8181/services/generalLedgerAccountConfig/isLedgerAccountNumberInUse/200%?_=1398694030799
周到的服務:
@Path("/generalLedgerAccountConfig")
public class ConfigGeneralLedgerAccount {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("isLedgerAccountNumberInUse/{ledgerAccountNumber}")
public Response isLedgerAccountNumberInUse(@PathParam("ledgerAccountNumber") String ledgerAccountNumber) {
...
}
}
任何想法為什么會引發500 http錯誤?
%在URI路徑中不是有效字符。 它代表一個不安全字符的ASCII碼的開始,並且在路徑中任何時候只要有一個“%”,后跟兩位數字即可。 在此之后是“?”。
如果要將文字%發送給服務器,則需要將其轉義為“%25”。 因此,您的客戶端未正確編碼URL。 無論客戶端是什么,當它從用戶那里獲得輸入時,都必須正確地對該URL進行編碼,以消除非法字符或逃避合法字符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.