从Http Servlet请求标头读取浏览器/客户端时间

问题描述:

是否可以在向servlet发出请求时读取浏览器(客户端计算机)时间?

Is it possible to read the Browser(Client machine) time when a request is made to the servlet?

I不要相信。遗憾的是,HTTP 日期标题仅发送给PUT或POST消息,即使这样它也是可选的:

I don't believe so. Unfortunately the HTTP Date header is only sent for PUT or POST messages, and even then it's optional:


客户端应该只在包含$ b的消息中发送Date头
字段$ b entity-body,如PUT
和POST请求的情况,即使这样,它也是
可选。没有时钟的客户
绝不能在
请求中发送Date头字段。

Clients SHOULD only send a Date header field in messages that include an entity-body, as in the case of the PUT and POST requests, and even then it is optional. A client without a clock MUST NOT send a Date header field in a request.

如果你有控制客户端,您可以(可能)将其编码为单独的实验性HTTP标头。或者将其添加为GET参数等。

If you have control of the client, you could (perhaps) encode it as a separate experimental HTTP header. Or add it as a GET parameter etc.