无法使用Java删除Firefox中的cookie; Firefox创建一个新的cookie,头上有点 [英] Fail to remove cookie in Firefox with Java; Firefox creates a new cookie with dot at the head

查看:170
本文介绍了无法使用Java删除Firefox中的cookie; Firefox创建一个新的cookie,头上有点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firefox中有这个Cookie:

  name:Vanilla-Volatile 

value:1 -1313808454 | 54614728ee113ab09e4db5c863cd5cfa | 1313635654 | 1 | 1313808454

domain:zhu13890.prod.xxxx.corp

路径:/

然后,我尝试用Java代码重置cookie:

 code> def c = new Cookie(Vanilla-Volatile,null); 
c.setDomain(zhu13890.prod.xxxx.corp);
c.setPath('/');
response.addCookie(c);

Firefox不会重置Cookie,而是使用 domain =创建一个新的cookie。 zhu13890.prod.xxxx.corp (注意头部有'。'。)



这个问题有解决方法吗? p>

我使用Firefox 3.6版。

解决方案

  c.setDomain(zhu13890.prod.xxxx.corp); 

可以为单个主机(默认)或整个域设置cookie。显然,您要为单个主机(zhu13890.prod.xxxx.corp,此脚本运行的主机)设置它。因此,您不应指定域。


I have this cookie in Firefox:

name:Vanilla-Volatile

value:1-1313808454|54614728ee113ab09e4db5c863cd5cfa|1313635654|1|1313808454

domain:zhu13890.prod.xxxx.corp

path:/

Then, I try to reset the cookie in Java with this code:

  def c = new Cookie("Vanilla-Volatile", null);
  c.setDomain("zhu13890.prod.xxxx.corp");
  c.setPath('/');       
  response.addCookie(c);

Instead of resetting the cookie, Firefox creates a new cookie with domain=.zhu13890.prod.xxxx.corp (notice the '.' at the head.)

Is there a workaround for this issue?

I'm using Firefox version 3.6.

解决方案

Remove this line:

c.setDomain("zhu13890.prod.xxxx.corp");

A cookie can either be set for a single host (the default) or for a whole domain. Apparently, you want to set it for a single host ("zhu13890.prod.xxxx.corp", the host where this script runs). So you should not specify a domain.

这篇关于无法使用Java删除Firefox中的cookie; Firefox创建一个新的cookie,头上有点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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