Java – cookie domain contains dot?

I use GWT's cookies class to generate cookies

When I use the following

Cookies.setCookie(LOGIN_COOKIE_NAME,value,expires);

business as usual. Checking cookies in the browser will cause mydomay Com works normally

However, when I use the following:

String path = "/"
String domain = "mydomain.com"
Cookies.setCookie(LOGIN_COOKIE_NAME,expires,domain,path,secure);

When I view in the browser, I can see a point in front of the domain:

.mydomain.com

Where does the point come from?

It turns out that if given mydomain. com,Cookies. Removecookie (login_cookie_name) doesn't work for me Why can't you delete this cookie when there is a point in front?

Solution

You must set the expiration date to now in order for the cookie to expire

Cookies.setCookie(COOKIE_NAME,"",new Date(),false);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>