JavaWeb_响应和请求数据包

时间:2025-04-07 20:36:49

  Google浏览器

  F12中Network->Header部分

  

JavaWeb_响应和请求数据包

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <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>
Hello,Gary! <br>
</body>
</html>

index.jsp

Network->Header部分

常规

    Request URL: http://localhost:8080/Gary_Text/
Request Method: GET
Status Code: 200 OK
Remote Address: [::1]:8080
Referrer Policy: no-referrer-when-downgrade

General

  Request URL: http://localhost:8080/Gary_Text/  资源的请求url
  Request Method: GET               HTTP方:GET
  Status Code: 200 OK              响应状态码  传送门
  Remote Address: [::1]:8080            请求的远程地址
  Referrer Policy: no-referrer-when-downgrade     传送门

    当用户在浏览器上点击一个链接时,会产生一个 HTTP 请求,用于获取新的页面内容,而在该请求的报头中,会包含一个 Referrer,用以指定该请求是从哪个页面跳转页来的,常被用于分析用户来源等信息。但是也有成为用户的一个不安全因素,比如有些网站直接将 sessionid 或是 token 放在地址栏里传递的,会原样不动地当作 Referrer 报头的内容传递给第三方网站。

Referrer Policy 介绍

响应包

    HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 617
Date: Thu, 11 Oct 2018 14:59:35 GMT

Response Headers

  HTTP/1.1 200 OK              Http协议的响应信息  1.1是协议的版本,200表示成功
  Server: Apache-Coyote/1.1          服务器
  Content-Type: text/html;charset=ISO-8859-1   压缩编码类型;服务端发送的类型及采用的编码方式
  Content-Length: 617                                              压缩码长度
  Date: Thu, 11 Oct 2018 14:59:35 GMT     GMT 客户端请求服务端的时间

请求包

    GET /Gary_Text/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,im age/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: JSESSIONID=86BA870896CF3A21211DFD6FEC345958

Request Headers

  GET /Gary_Text/ HTTP/1.1          请求地址
  Host: localhost:8080             连接的目标主机和端口号
  Connection: keep-alive                                           维护客户端和服务端的连接关系
  Cache-Control: max-age=0                                    服务端禁止客户端缓存页面数据
  Upgrade-Insecure-Requests: 1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36  客户端版本号的名字
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,im age/apng,*/*;q=0.8
  Accept-Encoding: gzip, deflate, br
  Accept-Language: zh-CN,zh;q=0.9                         客户端接收的语言类型
  Cookie: JSESSIONID=86BA870896CF3A21211DFD6FEC345958  客户端暂存服务端的信息