首页 > 其他 > 详细

异常解决:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

时间:2020-01-09 20:56:00      阅读:80      评论:0      收藏:0      [点我收藏+]

前言:

在用IE浏览器时访问tomcat项目时,页面报400错误,后台错误:

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

在网上查得资料时因为Tomcat版本在7以后会对http请求进行验证

解决办法:

1.使用encodeURI函数,因为IE浏览器无法对URL自动转义

2.JS使用post请求

//发送POST请求跳转到指定页面
function httpPost(URL, PARAMS) {
    var temp = document.createElement("form");
    temp.action = URL;
    temp.method = "post";
    temp.style.display = "none";

    for (var x in PARAMS) {
        var opt = document.createElement("textarea");
        opt.name = x;
        opt.value = PARAMS[x];
        temp.appendChild(opt);
    }

    document.body.appendChild(temp);
    temp.submit();

    return temp;
}

异常解决:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

原文:https://www.cnblogs.com/wutongshu-master/p/12172741.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!