我正在开发一个安静的webapp.在这里,我采用的参数是userid和orderid.
该userid可null.
URI是@Path("api/user/userid/order/orderid")
我的方法是,
void add(@PathParam("userid") String userId, @PathParam("orderid") String orderId);
Run Code Online (Sandbox Code Playgroud)
我想userId在URI中传递null值.
我试过了api/user//order/1234.但在这种情况下,userid取值orderId(即1234并且orderId是null.(这是错误的)
我也试过改变路径@Path("api/user/userid: .*/order/orderid").然而与之前的结果相同.
其他方式解决,这可能是使用@QueryParam的userid或创建的另一种方法userid null.
不过,我想知道是否有办法有userId作为PathParameter,而不是QueryParam和传递价值userid的null?