request.getHeader所想到的
request.getHeader(""),简单的说就是获取请求的头部信息,根据http协议,它能获取到用户访问链接的信息。
/** * Returns the value of the specified request header * as a <code>String</code>. If the request did not include a header * of the specified name, this method returns <code>null</code>. * If there are multiple headers with the same name, this method * returns the first head in the request. * The header name is case insensitive. You can use * this method with any request header. * @param name a <code>String</code> specifying the * header name * @return a <code>String</code> containing the * value of the requested * header, or <code>null</code> * if the request does not * have a header of that name */ public String getHeader(String name);
比如我访问http://www.cnblogs.com/winner-0715/category/828769.html
可以抓取http请求头
GET /winner-0715/category/828769.html HTTP/1.1 Host: www.cnblogs.com Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Referer: http://www.cnblogs.com/winner-0715/p/6215102.html Accept-Encoding: gzip, deflate, sdch Accept-Language: zh-CN,zh;q=0.8
request.getHeader("Referer"); 得到的就是 http://www.cnblogs.com/winner-0715/p/6215102.html
-----
request.getHeader("Host"); 得到的就是 http://www.cnblogs.com/
request.getHeader所想到的的更多相关文章
- servlet request getHeader(“x-forwarded-for”) 获取真实IP
request方法客户端IP: request.getRemoteAddr() 输出:192.168.0.106 客户端主机名:request.getRemoteHost()输出:abc reques ...
- request.getHeader("Referer")理解【转载】
request.getHeader("Referer")用于获取来源页地址,但有时却为空值,这是怎么回事.原因如下: getHeader("Referer")要 ...
- 【JS】【5】request.getHeader("referer")的作用
正文: request.getHeader("referer"):获取来访者地址 注意:只有通过链接访问当前页的时候,才能获取上一页的地址,以下情况是获取不到值的: 只有通过链接访 ...
- 7:servlet request getHeader("x-forwarded-for") 获取真实IP
在JSP里,获取客户端的IP地址的方法是:request.getRemoteAddr(),这种方法在大部分情况下都是有效的.但是在通过了 Apache,Nagix等反向代理软件就不能获取到客户端的真实 ...
- request.getHeader不区分大小写
<!--查看输出信息--><% System.out.println("Header...."); Enumeration<String> e = r ...
- web页面防盗链功能使用--request.getHeader("Referer")
使用Request对象设置页面的防盗链 所谓的防盗链就是当你以一个非正常渠道去访问某一个Web资源的时候,服务器会将你的请求忽略并且将你的当前请求变为按正常渠道访问时的请求并返回到相应的页面,用户只有 ...
- request.getHeader("x-forwarded-for")这是什么意思
request.getHeader,简单的说就是获取请求的头部信息,根据http协议,它能获取到用户访问链接的信息,以下是我们常用的: request.getHeader("referer& ...
- request.getHeader("referer")
在开发web程序的时候,有时我们需要得到用户是从什么页面连过来的,这就用到了referer. 它是http协议,所以任何能开发web程序的语言都可以实现,比如jsp中是: request.getHea ...
- servlet中使用request.getHeader("referer")获取页面从哪跳转过来的
问题 servlet中使用request.getHeader("referer")获取页面从哪跳转过来的,利用这个方法可以判断网页是否正常登录.我做了一个javaweb小项目,其中 ...
随机推荐
- iOS学习37数据处理之CoreData
1. CoreData数据库框架的优势 1> CoreData历史 CoreData数据持久化框架是Cocoa API 的一部分,首次在iOS5版本的系统中出现,它允许按照实体-属性-值模型组织 ...
- 使用 smartupload 上传图片
使用 smartupload 请参见 elleniou 的 博客 : http://www.cnblogs.com/elleniou/archive/2012/09/24/2700583.html
- 洛谷 P1305 新二叉树 Label:字符串的输出总是有惊喜
题目描述 输入一串完全二叉树,用遍历前序打出. 输入输出格式 输入格式: 第一行为二叉树的节点数n. 后面n行,每一个字母为节点,后两个字母分别为其左右儿子. 空节点用*表示 输出格式: 前序排列的完 ...
- Command mvn jetty:run
How to use the command mav jetty:run? There is a simple display as below: Step 1: You should generat ...
- Maven3路程(一)用Maven创建第一个web项目(2)
工具/原料 Windows 系统 JDK 1.5 及以上版本 Maven 3.0 及以上版本 方法/步骤 1 首先检查Eclipse是否已经添加的Maven插件,打开Eclipse, 依次选择 &qu ...
- (转)深入理解flash重绘
深入理解Flash Player重绘 Flash Player 会以SWF内容的帧频速度来刷新需要变化的内容,而这个刷新的过程,我们通常称为“重绘(redraw)”,相信即便是初级的菜鸟也知道,只要使 ...
- 如何通过js和jquery获取图片真实的宽度和高度
什么时候需要获取图片真实的宽度和高度 在做pc网页的时候,有时候会考虑按照插入的图片的尺寸来判断图片是横图还是竖图.然后判断过后给予不同的展示方式! 另外一种就是在手机页面上,在新闻页插入的图片往往都 ...
- gcc 编译器参数
一.GCC编译过程 参考:http://hi.baidu.com/zengzhaonong/item/c00e079f500adccab625314f------------------------- ...
- CAS单点登录中文用户名乱码问题
CAS单点登录中文用户名乱码问题,有两种情况 1. CAS server乱码 即在向server端提交用户名和密码时,发生了乱码,解决方法是: 打开WEB-INF/web.xml,在其它的Filter ...
- iframe自适应高度js
<iframe src="http://www.fufuok.com/" id="iframepage" name="iframepage&qu ...