后台提示:

严重: 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)...

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

项目简述:在js中操作cookie时出现的异常(Jquery中依然能用)

基本代码如下:(已修改)

 if("Administrator"==result.data.username){//管理员设计
document.cookie="username="+escape('系统管理员');
// $.cookie('username','系统管理员');
}else{//普通员工设计
document.cookie="username="+escape(result.data.username);
document.cookie="postId="+result.data.postId;//职务Id
document.cookie="induction_time="+result.data.induction_time;//入职时间
document.cookie="monthlyleave="+result.data.monthlyleave;//当月假期
} document.cookie="userId="+result.data.id;//
document.cookie="identification="+result.data.identification;//标记

异常分析:

1.cookie值有问题

2.cookie中编码有问题,一般都是中文那里

修改:在js中调用escape(“中文”),进行编码,

在读取cookie时,用unescape(document.cookie);进行解码

补充:

有的是在服务器端代码遇到的问题,请到服务器端去修改编码(服务器端不用escape)。

异常:java.lang.IllegalArgumentException: Control character in cookie value or attribute.的更多相关文章

  1. cookie遇到java.lang.IllegalArgumentException: Control character in cookie value or attribute

    java.lang.IllegalArgumentException: Control character in cookie value or attribute. 该异常说明cookie中的val ...

  2. HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.

    HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: ...

  3. tomcat使用cookies缓存的时候中文报错解决办法 java.lang.IllegalArgumentException: Control character in cookie value or attribute.

    报错出现 java.lang.IllegalArgumentException: Control character in cookie value or attribute. at org.apac ...

  4. Cookie存储中文报错:java.lang.IllegalArgumentException: Control character in cookie value or attribute.(转)

    项目中做自动登录和保存密码时,Cookie报错Java.lang.IllegalArgumentException,上google查了下 在http://hi.baidu.com/xtxycy/blo ...

  5. 在浏览器访问Tomcat的时候报错java.lang.IllegalArgumentException: Control character in cookie value or attribute.

    出现这种情况的原因就是因为cookie中存在中文或者特殊符号造成的,应为Tomcat7不支持 解决方法: 1,首先必须先删除本地的cookie,否则项目无法访问 2,然后调整编码就行了

  6. 创建Cookie抛出异常:java.lang.IllegalArgumentException: Control character in cookie value

    调用Cookie对象的构造函数可以创建Cookie.Cookie对象的构造函数有两个字符串参数:Cookie名字和Cookie值.   名字和值都不能包含空白字符以及下列字符:[ ] ( ) < ...

  7. 解决Tomcat的IllegalArgumentException: Control character in cookie value or attribute错误

    接口中带有中文,tomcat8 17-Apr-2019 13:21:23.734 严重 [http-nio-8082-exec-2] org.apache.coyote.http11.Abstract ...

  8. Nginx配置Tomcat8反向代理出现 java.lang.IllegalArgumentException: The character [_] is never valid in a domain name.

    在配置Nginx的反向代理,访问反向代理的路径而出现了异常 java.lang.IllegalArgumentException: The character [_] is never valid i ...

  9. 异常java.lang.IllegalArgumentException:attempt to create delete event with null entity

    异常java.lang.IllegalArgumentException:attempt to create delete event with null entity解决:路径问题,前台jsp和ja ...

随机推荐

  1. 在windows操作系统中,查询端口占用和清除端口占用的程序

    一.在windows操作系统中,查询端口占用和清除端口占用的程序 提升权限后用:netstat -b或用 1.查询端口占用的进程ID 点击"开始"-->"运行&qu ...

  2. 数据挖掘之Python调用R包、函数、脚本

    Python中集成R :参考博客http://blog.csdn.net/weidelight/article/details/44946785

  3. 关于mybatis mapper.xml中的if判断

    场景: 页面上有搜索框进行调节查询,不同搜索框中的内容可以为空. 过程: 点击搜索,前端把参数传给后台,这是后台要把为空的参数过滤掉. 做法: 通常我们在dao层即mapper.xml中进行过滤判断操 ...

  4. Linux用root强制踢掉已登录用户;用fail2ban阻止ssh暴力破解root密码

    Linux用root强制踢掉已登录用户   首先使用w命令查看所有在线用户: [root@VM_152_184_centos /]# w 20:50:14 up 9 days, 5:58, 3 use ...

  5. FortiDDoS是使用历史流量基线进行检测的

    Understanding FortiDDoS Detection ModeIn Detection Mode, FortiDDoS logs events and builds traffic st ...

  6. js点击复制功能的实现

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  7. 【Wannafly挑战赛9-A】找一找

    链接:https://www.nowcoder.net/acm/contest/71/A 题目描述 给定n个正整数,请找出其中有多少个数x满足:在这n个数中存在数y=kx,其中k为大于1的整数 输入描 ...

  8. SQL SERVER 正则替换

    use pubdbgo IF OBJECT_ID(N'dbo.RegexReplace') IS NOT NULL DROP FUNCTION dbo.RegexReplace GO --开始创建正则 ...

  9. Marketing™Series用户手册(Marketing™Series Manual)

    起源(Origin) 每日构建(Daily Build) 软件不支持的功能(Functions which are not supported.) 软件支持的功能(Functions which ar ...

  10. LeetCode OJ:Implement Trie (Prefix Tree)(实现一个字典树(前缀树))

    Implement a trie with insert, search, and startsWith methods. 实现字典树,前面好像有道题做过类似的东西,代码如下: class TrieN ...