How to have a @PATCH annotation for JAX-RS?

前端 未结 5 553
渐次进展
渐次进展 2021-01-30 19:51

JAX-RS has annotations for HTTP verbs such as GET (@GET) and POST (@POST) but there is no @PATCH annotation. How

5条回答
  •  孤独总比滥情好
    2021-01-30 20:21

    JAX-RS API 2.0.1 doesn't have PATCH. But, looking at JAX-RS API 2.2-SNAPSHOT code, PATCH is now included. The code is:

    @Target({ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    @HttpMethod(HttpMethod.PATCH)
    @Documented
    public @interface PATCH {
    }
    

    Here is the link.

    You might use the same codes for remedy until 2.2 is out. For HttpMethod.PATCH, just replace it with "PATCH".

提交回复
热议问题