Jersey @DefaultValue 不适用于 Regex 定义的路径
Jersey @DefaultValue not working with Regex defined path
@GET
@Path("multiply/{first: ((\+|-)?\d+)?}{n:/?}{second:((\+|-)?\d+)?}")
public String multiply(@PathParam("first") int first,
@DefaultValue("1") @PathParam("second") int second) throws Exception {
return first * second;
}
当请求 HOST/multiply/3
结果应该是 3
,但返回 0
因为 second
由于某种原因是 0
,但应该是 1
.
为什么默认值设置不正确?
我在 public 电子邮件线程中的某个地方发现 @DefaultValue
无法与 @PathParam
一起使用,事实上这应该只在 jersey 文档中工作 error/bug。
@GET
@Path("multiply/{first: ((\+|-)?\d+)?}{n:/?}{second:((\+|-)?\d+)?}")
public String multiply(@PathParam("first") int first,
@DefaultValue("1") @PathParam("second") int second) throws Exception {
return first * second;
}
当请求 HOST/multiply/3
结果应该是 3
,但返回 0
因为 second
由于某种原因是 0
,但应该是 1
.
为什么默认值设置不正确?
我在 public 电子邮件线程中的某个地方发现 @DefaultValue
无法与 @PathParam
一起使用,事实上这应该只在 jersey 文档中工作 error/bug。