【问题标题】:(Jersy) How to write Get method without parameters(泽西)如何编写没有参数的Get方法
【发布时间】:2018-09-04 06:21:24
【问题描述】:

我想在没有 QueryParam 的情况下编写以下 GET 方法

理想情况下它应该返回所有记录。

 @GET
 @Produces( { MediaType.APPLICATION_JSON } )
 Response getAircraft( @Context SecurityContext aSc, @QueryParam( ID_PARAM ) String aAircraftId );

知道如何实现吗?

【问题讨论】:

  • 为什么不直接删除QueryParam

标签: jersey jax-rs jersey-2.0


【解决方案1】:

您只需要删除 QueryParam 和变量,使其看起来像这样:

@GET
@Produces( { MediaType.APPLICATION_JSON } )
Response getAircraft( @Context SecurityContext aSc) {
//return something
}

泽西文档非常好,因此您可以在那里找到大部分所需的东西:https://jersey.github.io/documentation/latest/jaxrs-resources.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-11
    • 2016-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多