请求方式有很多种,最常见的有get和post两种方式
get
消息头:请求方式;请求的资源,请求的协议的版本号
get的特点:在URL地址后面可以带上?参数,但是参数数据有限制,不能超过1K
get将数据作为httpURl后面的参数进行提交
GET /books/jav
a.html HTTP/1.1
Accept: */*
Accept-Language: en-us
Connection: Keep-Alive
Host: localhost
Referer: http://localhost/links.asp
User-Agent: Mozilla/4.0
Accept-Encoding: gzip, deflate
post:
POST /servlet/ParamsServlet HTTP/1.1
Host:
Content-Type: application/x-www-form-urlencoded
Content-Length: 28
name=abc&password=xyz
在请求的实体类携带数据向服务器发送数据,携带的数据没有限制
post方式是将数据作为http实体中内容进行提交,例如表哥提交