• HTTP Method小结


     

    GET 从指定的url上获取内容

    POST 提交body中的内容给服务器中指定的url中,属于非幂等的(non-idempotent)请求

    HEAD 从指定的url上获取header内容(类似Get方式)

    TRACE Allows a programmer to see how the client's message is modified as it passes through a series of proxy servers. The recipient of a TRACE method echoes the HTTP request headers back to the client

    PUT 将body上传至服务器指定url处

    DELETE 在指定url处删除资源

    OPTIONS 获取指定url中能接收的请求方法

    CONNECT 连接指定频段。当客户端需要通过代理服务器连接HTTPS服务器是用到。

    1.GET

    例子:

    GET  /select/selectBeerTaste.jsp?color=dark&taste=malty HTTP/1.1 Host: www.wickedlysmart.com User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/ 20030624 Netscape/7.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

    2.POST

    例子:

    POST  /advisor/selectBeerTaste.do HTTP/1.1 Host: www.wickedlysmart.com User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/ 20030624 Netscape/7.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

    color=dark&taste=malty

    GET vs POST :除了大小不同,前者能保存书签,后者不是幂等性的,表单默认是GET方式提交除非指定method=post

    本文摘抄于:http://blog.csdn.net/ultrani/article/details/5308825

  • 相关阅读:
    右下角老弹出盗版提示,以及登录界面出现正版验证对话框
    动态TSQL语句常見問題與解決方案
    验证码
    远程调用存储过程
    windows powershell
    屏蔽IE浏览器的刷新(不包括单个刷新按钮)
    获取数据库中的数据库有多少个
    网页刷新方法集合
    Win7中IIS7安装配置
    sql 根据字段查表名
  • 原文地址:https://www.cnblogs.com/waterBlog/p/3696300.html
Copyright © 2020-2023  润新知