REST服务(实现 - Apache-cxf)api url是
/客户/ {客户ID}
@GET
@Path("/{customerId}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getCustomer(@PathParam("customerId") Long customerId) throws Exception {
}
customerId是Long类型但是如果我传递字符串,它会抛出404异常,而我期望服务抛出400异常。我是否必须明确设置http状态代码? JAX-RS不会这样做吗?