0
處理我在新澤西州的Servlet的方法錯誤澤西寧靜的API
@POST
@Path("{type}:{bank_code}/accounts/{account}")
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public String VerifyRecipient(MultivaluedMap<String,String> requestParamsPost,
@PathParam("type") String type,
@PathParam("bank_code") String bank_code,
@PathParam("account") String account) {
String ret=null;
Integer trxn_type_id=null;
this.logger = LogFactory.getLog(getClass());
if(account==null){
throw new WebApplicationException(Response.status(
Response.Status.NOT_FOUND).type(
MediaType.APPLICATION_JSON).entity(
"Account is not found").build());
}
如果有人不給了{}帳戶的任何值我想返回一個404未找到JSON響應。但是我的問題是,{account}沒有價值時,請求甚至沒有達到我的方法。有什麼辦法可以解決這個問題嗎?
請求的形式如下:curl -i -X POST -d「initiator_id = mobile_number:9818526878&customer_id = 8376118083」http:// localhost:8080/eko/v1/banks/bank_id:203/accounts/given no value for參數賬號 – Nirmal