Http响应协议

响应协议

 

1 响应信息

// 响应首行
HTTP/1.1 200 OK
// 响应头信息
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Length: 777
Date: Sat, 09 Feb 2012 18:30:52 GMT
// 空行,下面是响应正文,即HTML代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="http://localhost:80/hello/">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    This is my JSP page. <br>
    
    <form method="post" action="index.jsp">
    	<input type="text" name="username" /><br/>
    	<input type="submit" value="SUBMIT"/>
    </form>
  </body>
</html>

HTTP/1.1 200 OK:响应协议为HTTP1.1,状态码为200,表示请求成功,OK是对状态码的解释;

Server: Apache-Coyote/1.1:这是服务器的版本信息;

Content-Type: text/html;charset=UTF-8:请求正文使用的编码为UTF-8

Content-Length: 777:响应的内容为777字节;

Set-Cookie: JSESSIONID=C97E2B4C55553EAB46079A4F263435A4; Path=/hello:响应给客户端的Cookie

Date: Sat, 09 Feb 2012 18:30:52 GMT:响应的时间这个时间是美国时间,这可能会有8小时的时区差;

 

常见状态码:

404 not found:没有找到;

500 error:找到了,但内部出错;

200 ok:成功!

<!--EndFragment-->

<!--EndFragment-->

猜你喜欢

转载自olikeit.iteye.com/blog/1847295