• requesMapping注解


    java类

    package
    org.springframework.web.bind.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Mapping public @interface RequestMapping { String name() default ""; @AliasFor("path") String[] value() default {}; @AliasFor("value") String[] path() default {}; RequestMethod[] method() default {}; String[] params() default {}; String[] headers() default {}; String[] consumes() default {}; String[] produces() default {}; }

    value:  指定请求的实际地址, 比如 /action/info之类。
    method:  指定请求的method类型, GET、POST、PUT、DELETE等
    consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html;
    produces:    指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回
    params: 指定request中必须包含某些参数值是,才让该方法处理
    headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求

    其中,consumes, produces使用content-typ信息进行过滤信息;headers中可以使用content-type进行过滤和判断。

    http://blog.csdn.net/shinebar/article/details/54408020

  • 相关阅读:
    Mybatis学习总结(五)——动态sql
    1006 换个格式输出整数(15分)
    1005 继续(3n+1)猜想(25分) *
    1004 成绩排名(20分)
    1003 我要通过!(20分)*
    1002 写出这个数(20分) *
    1001 害死人不偿命的(3n+1)猜想(15分)
    CCSP 201312-2 ISBN号码
    CCSP201312-1出现次数最多的数
    c++动态定义数组
  • 原文地址:https://www.cnblogs.com/liyafei/p/8515319.html
Copyright © 2020-2023  润新知