java - 是否可以在http请求中获取输入设备详细信息

标签 java servlets httprequest

我正在尝试获取发出请求的输入设备的详细信息。

我想知道,使用 httpservlet 请求对象是否可以实现这一点。

最佳答案

查看 HTTP header USER-AGENTheaders

This line if present gives the software program used by the original client. This is for statistical purposes and the tracing of protocol violations. It should be included. The first white space delimited word must be the software product name, with an optional slash and version designator. Other products which form part of the user agent may be put as separate words.

  <field>   =   User-Agent: <product>+
    <product> =   <word> [/<version>]
    <version> =   <word>

示例:

           User-Agent:  LII-Cello/1.0  libwww/2.5

获取它们

Header[] allHeaders = req.getAllHeaders();

每个 header 对象都包含名称和值。

关于java - 是否可以在http请求中获取输入设备详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18847748/

相关文章:

servlets - 如何从 OSGi HttpService 中注册的 Servlet 获取 OSGi 服务引用?

angularjs - 如何在 AngularJS 上验证对 OrientDB 函数的 HTTP 请求?

java - Java 方法引用中表达式的运行时评估

java - 如何用java生成森林

java - 如何在 Java 中将 View 文件输出为 ajax 响应?

java - 尝试使用 servlet 和 jsp 插入 mysql 时出现错误

asp.net-mvc - 从客户端检测到危险的 Request.Form 值 - 为什么?

ruby-on-rails - 如何将 Office 365 REST API 集成到我的 Ruby on Rails 应用程序中?

java - 如何更新 Dynamo DB 中保留关键字的值。错误: Attribute name is a reserved keyword; reserved keyword: data

java - 在代号一中动态填充列表