javax.servlet.http.Cookie的getDomain()返回null [英] getDomain() of javax.servlet.http.Cookie is returning null

查看:133
本文介绍了javax.servlet.http.Cookie的getDomain()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何获得cookie的实际域名?
getDomain(),getPath()返回null也设置了相应的值。

和我正在使用response.addCookie(cookie)

>

提前致谢。

问候,
Prashant

>解决方案

来自浏览器的cookies 可能没有这个数据。只有cookie名称和cookie值。查看HTTP规范,了解浏览器设置了哪些cookie标头并发送到了服务器。


How can I get actual domain of a cookie ? getDomain(), getPath() are returning null also I have set the appropriate values.

and I am using response.addCookie(cookie)

Thanks in advance.

Regards, Prashant

解决方案

Cookies coming in from the browser probably don't have this data available. Only cookie name and cookie value. See the HTTP specs for what cookie headers are set by the browser and sent to the server.

这篇关于javax.servlet.http.Cookie的getDomain()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆