由于公司要用JAVA开发平台,所以现在转学JAVA。该平台运用到了Spring框架,所以先学Spring咯。
Spring MVC:
@RequestMapping
属性:
value:指请求的实际地址
method:与服务器交互的几种方法;get,post,put,delete等
consumes:指定处理的请求类型比如:text/html;application/json;
produces:指定返回内容的类型,只有当请求头中的Accept包含该指定类型时才使用;比如百度上找的一个:
Accept : "image/png,image/*;q=0.8,*/*;q=0.5"。
params:指定request中包含该参数的指时,才让该方法处理请求,我理解成必须传入的参数
headers:指定的request中包含某些header时,才让该方法处理请求,下面是在百度上抄下来的header内容。比如,也许我们可以指定User-Agent的值为"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0"时,才继续处理请求。这样可以阻止部分用户模拟请求(我是这么理解地)
Host:"sp3.baidu.com"
User-Agent:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0"
Accept:"image/png,image/*;q=0.8,*/*;q=0.5"
Accept-Encoding:"gzip, deflate, br"
Referer:"https://www.baidu.com/s?wd=http%20get&rsv_spt=1&rsv_iqid=0xcbbe151f00022bad&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=0&oq=http%20get&rsv_t=a68ctX91lIYkp2G9Z5iPW2wKwfMG%2BNEFTwUNEnYkLUDlj8KzoHgYbCpPmnxrKQZhrNDh&rsv_pq=d29f4a7800033056"
Cookie:"BAIDUID=2EB099183DC5BCA26992E801FDA81D4F:FG=1; BIDUPSID=2EB099183DC5BCA26992E801FDA81D4F; PSTM=1464718902; H_PS_PSSID=1429_18241_20076_17001_15460_12422_20252; BDSFRCVID=iyDsJeCCxG3RC6RR_s5bKk5tQ9ssUbWwd2Tp3J; H_BDCLCKID_SF=tRk8oI-XJCvjD4-k247Hhn8thmT22-usfC0LQhcH0hOWsIO1-nrc0l4y2t5v2po85nvmLbcH3tt5eDbxDUC0Djb-Da8fJTnJ-D6206uatRcoH6rnhPF3e5JDKP6-3MJO3b7OhRk5Lf75HxJHe5AVhJD0jb6OqPRJ0KJeohFLtK-KhI-6jjRb5nbHhMr-bPcXHD7yWCvVMlb5OR5JLn7nDpDdjR5NybttKe3W_4blf4O5SJo55P8K3bOyyG62btt_JnAqVC3P; BDUSS=mVSZEJxMFB6VnR6SzJ-dGpLQTNGMnFJV0RhU3F4RE9uZU9JZFBLenlLOGRRSGxYQVFBQUFBJCQAAAAAAAAAAAEAAAC1twhj0anA77DXu6i7qMyrsNcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2zUVcds1FXd; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0"
Connection:"keep-alive"