各种HTTP method的请求头和响应报文的例子,供以后参考。
目录
一、OPTIONS
request:
OPTIONS /boeing/headerServlet HTTP/1.1
Host: 127.0.0.1:8000
response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Content-Length: 0
Date: Mon, 16 May 2011 10:47:32 GMT
二、HEAD/GET
request:
HEAD /boeing/headerServlet HTTP/1.1
Host: 127.0.0.1:8000
或
GET /boeing/headerServlet HTTP/1.1
Host: 127.0.0.1:8000
response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: testCookie=book; Path=/pp/ll
Content-Length: 0
Date: Mon, 16 May 2011 10:56:37 GMT
三、TRACE
request:
TRACE /boeing/headerServlet HTTP/1.1
Host: 127.0.0.1:8000
response:
HTTP/1.1 405 Method Not Allowed
Server: Apache-Coyote/1.1
Allow: POST, GET, DELETE, OPTIONS, PUT, HEAD
Content-Length: 0
Date: Mon, 16 May 2011 10:57:50 GMT
四、DELETE
request:
DELETE /boeing/test.html HTTP/1.1
Host: 127.0.0.1:8000
response:
HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
Date: Mon, 16 May 2011 11:06:09 GMT
五、PUT
生成test.html 内容是ddddddd
request:
PUT /boeing/test.html HTTP/1.1
Host: 127.0.0.1:8000
Content-Length: 7ddddddd
response:
HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
Date: Mon, 16 May 2011 11:09:45 GMT