【问题标题】:Why my PathSegment is null while @PathParam is not null?为什么我的 PathSegment 为空,而 @PathParam 不为空?
【发布时间】:2016-07-19 06:53:09
【问题描述】:

使用以下代码,serviceIdSegmentnullserviceId 不是 null

class MySubResource {

    @GET
    @Path("{serviceId: .+}")
    public Response readById(@PathParam String serviceId) {
        // serviceId is not null
        // why serviceIdSegment is null?
    }

    @PathParam("serviceId");
    private PathSegment serviceIdSegment;
}

谁能告诉我为什么?

【问题讨论】:

    标签: jax-rs path-parameter


    【解决方案1】:

    当我试图回答时,我注意到这个问题是我的。

    readById 方法在根资源类匹配后进行惰性求值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-14
      • 1970-01-01
      • 1970-01-01
      • 2021-10-11
      • 2021-08-02
      • 2016-09-04
      • 2018-06-26
      • 2010-11-25
      相关资源
      最近更新 更多