zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    STM8s窗口看门狗
    开篇
    习题6-8 统计一行文本的单词个数
    习题9-4 查找书籍
    习题9-3 平面向量加法
    习题9-1 时间换算
    习题7-8 字符串转换成十进制整数
    习题8-10 输出学生成绩
    习题7-7 字符串替换
    习题7-6 统计大写辅音字母
  • 原文地址:https://www.cnblogs.com/liyafei/p/8515319.html
Copyright © 2011-2022 走看看