Exception: Java.lang.IllegalArgumentException:Control character in cookie value or attribute.

Source: Internet
Author: User

Background prompt:

Severity: Error Processing request
Java.lang.IllegalArgumentException:Control character in cookie value or attribute.
At Org.apache.tomcat.util.http.CookieSupport.isV0Separator (cookiesupport.java:165)
At Org.apache.tomcat.util.http.Cookies.processCookieHeader (cookies.java:349)
At Org.apache.tomcat.util.http.Cookies.processCookies (cookies.java:176)
At Org.apache.tomcat.util.http.Cookies.getCookieCount (cookies.java:106) ...

————————————————————————————————————————————————————\

Project brief: The exception that occurs when manipulating cookies in JS (still available in jquery)

The basic code is as follows: (modified)

 if("Administrator" ==result.data.username) {//Administrator DesignDocument.cookie= "Username=" +escape (' System Administrator '); //$.cookie (' username ', ' system Administrator ');}Else{//General Staff DesignDocument.cookie= "Username=" +Escape (Result.data.username); Document.cookie= "Postid=" +result.data.postid;//Job IDDocument.cookie= "Induction_time=" +result.data.induction_time;//Time of entryDocument.cookie= "Monthlyleave=" +result.data.monthlyleave;//Holiday of the month} document.cookie= "Userid=" +result.data.id;//Document.cookie= "identification=" +result.data.identification;//Mark                                                

Exception Analysis:

Problem with 1.cookie value

There is a problem with coding in 2.cookie, usually in Chinese.

Modify: In JS call Escape ("Chinese"), to encode,

When reading a cookie, use Unescape (Document.cookie) to decode

Add:

There are some problems encountered in server-side code, please go to the server to modify the code (server-side without escape).

Exception: Java.lang.IllegalArgumentException:Control character in cookie value or attribute.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.