Andrea Baglioni
Andrea Baglioni

Reputation: 303

Strange error using XPages

Only in some cases, i've this error calling and XPage

java.lang.illegalArgumentException: Cookie name "some name" is a reserved token

What could be the cause? How to resolve this?

UPDATE

this is the full error row inside error-log-0.xml

<values>java.lang.IllegalArgumentException: Cookie name &quot;Urbanistica e    
Verde&amp;count&quot; is a reserved token&#xA;&#x9;at java.lang.Throwable.&lt;init&gt;
(Throwable.java:67)&#xA;&#x9;at javax.servlet.http.Cookie.&lt;init&gt;
(Cookie.java:128)&#xA;&#x9;at com.ibm.domino.xsp.bridge.http.servlet.XspCmdHttpServletRequest.parseCookieString (XspCmdHttpServletRequest.java:338)&#xA;&#x9;at com.ibm.domino.xsp.bridge.http.servlet.XspCmdHttpServletRequest.getCookies(XspCmdHttpServletRequest.java:269)&#xA;&#x9;at com.ibm.domino.xsp.bridge.http.servlet.XspCmdHttpServletRequest.readSessionId(XspCmdHttpServletRequest.java:171)&#xA;&#x9;at com.ibm.domino.xsp.bridge.http.servlet.XspCmdHttpServletRequest.&lt;init&gt;(XspCmdHttpServletRequest.java:142)&#xA;&#x9;at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:256)&#xA;</values>

UPDATE 2

XSP has this SSJS in afterPageLoad event

var cgi = new CGIVariables();
var exCon = facesContext.getExternalContext();
var response = exCon.getResponse();
response.setHeader("cache-control", "no-cache");
response.setDateHeader("Expires", -1);

com.xxx.MyClass.myMethod(
    facesContext.getExternalContext().getRequest(), 
    response
);

facesContext.responseComplete();

CGIVariables is a Server Javascript function (see here), but actually is not used. In myMethod inside MyClass i don't set cookies. Could be the problem in CGIVariables function?

UPDATE 3 I've made some screenshot about traffic network (with IE development tool), with the requests made. Here the requests:

enter image description here

Here the details about a request:

enter image description here

Here the details about cookies sent (as you can see, there are no cookies with the reserved name, the string Urbanistica e Verde is in the value of one of the cookies -> see the red line) enter image description here

UPDATE 4

Problem seems related to the cookie value, not to the cookie name. Deleting ',' character in cookie value solve the problem

Upvotes: 0

Views: 438

Answers (1)

Greg
Greg

Reputation: 714

Basically, you are using an illegal name.

From this website,

The name must conform to RFC 2965. That means it can contain only ASCII alphanumeric characters and
cannot contain commas, semicolons, or **white space** or begin with a $ character.

There are also other characters that cannot be used.

Upvotes: 1

Related Questions