request.getHeader("User-Agent") 为空情况

灰蛋一个 2013-08-08 09:44:51
请教 request.getHeader("User-Agent") 为空的情况 大虾
...全文
773 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
引用 3 楼 splendid_java 的回复:
在jsp里?
jsp里 就是index页面 判断用户的UA 为毛有为空的情况 ?
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
@oh_Maxy 来看看
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
恩 浏览器里 咋访问的啊
末日哥 2013-08-08
  • 打赏
  • 举报
回复
没用浏览器?
ZHOU西口 2013-08-08
  • 打赏
  • 举报
回复
在jsp里?
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
人呢
灰蛋一个 2013-08-08
  • 打赏
  • 举报
回复
引用 8 楼 fangmingshijie 的回复:
getHeader java.lang.String getHeader(java.lang.String name) Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. 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.
If the request did not include a header of the specified name, this method returns null why did the request not include a header ???
owen1759 2013-08-08
  • 打赏
  • 举报
回复
把下面这个复制到命令行(cmd.exe)中,回车看结果

telnet localhost 80
GET / HTTP/1.1

任何header都是有可能没有的,何止是UA
  • 打赏
  • 举报
回复
getHeader java.lang.String getHeader(java.lang.String name) Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. 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.

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧