Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
谷歌浏览器正常运行
IE浏览器下钻报表报错:
HTTP Status 400 – Bad Request
Type Exception Report
Message Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
Exception
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:483)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/8.5.43
原因:ie中URL中有中文字符,
解决办法:请求url做下 encodeURI(url) 可以解决。
eg:
修改前:
var ymd = $("div[widgetname=REPORT2] tr:eq(0) td:eq(5)").text();
var y = $("div[widgetname=REPORT2] tr:eq(0) td:eq(6)").text();
var m = $("div[widgetname=REPORT2] tr:eq(0) td:eq(7)").text();
var ym = $("div[widgetname=REPORT2] tr:eq(0) td:eq(8)").text();
var title;
if (ymd == 'y') {
title = y + "年";
} else {
title = y + "年" + m + "月";
}
var $iframe = $("<iframe id='inp' name='inp' width='100%' height='100%' overflow-x='hidden'; scrolling='no' frameborder='0'>"); // 对话框内
// iframe 参数的命名,默认宽高占比是 100%,可向下滚动
$iframe.attr("src", "${servletURL}?viewlet=" + encodeURIComponent("大屏/大屏子报表/各公司节点完成率排名") + ".frm&ymd=" + ymd + "&y=" + y + "&m=" + m + "&ym=" + ym + "&title=" + title); // 给 iframe 添加
// src 属性
var o = {
width: 800, //对话框宽度
height: 600, //对话框高度
overflow: 'auto'
};
FR.showDialog("", o.width, o.height, $iframe, o); //弹出对话框
setTimeout(function() {
$('.fr-core-window-header')[0].style.backgroundColor = "#0a1215";
$('.fr-core-window-body')[0].style.border = "none";
}, 100)
修改后:
var ymd = $("div[widgetname=REPORT2] tr:eq(0) td:eq(5)").text();
var y = $("div[widgetname=REPORT2] tr:eq(0) td:eq(6)").text();
var m = $("div[widgetname=REPORT2] tr:eq(0) td:eq(7)").text();
var ym = $("div[widgetname=REPORT2] tr:eq(0) td:eq(8)").text();
var title;
if (ymd == 'y') {
title = y + "年";
} else {
title = y + "年" + m + "月";
}
var $iframe = $("<iframe id='inp' name='inp' width='100%' height='100%' overflow-x='hidden'; scrolling='no' frameborder='0'>"); // 对话框内
// iframe 参数的命名,默认宽高占比是 100%,可向下滚动
var url = encodeURI("${servletURL}?viewlet=" + encodeURIComponent("大屏/大屏子报表/各公司节点完成率排名") + ".frm&ymd=" + ymd + "&y=" + y + "&m=" + m + "&ym=" + ym + "&title=" + title);
$iframe.attr("src", url); // 给 iframe 添加
// src 属性
var o = {
width: 800, //对话框宽度
height: 600, //对话框高度
overflow: 'auto'
};
FR.showDialog("", o.width, o.height, $iframe, o); //弹出对话框
setTimeout(function() {
$('.fr-core-window-header')[0].style.backgroundColor = "#0a1215";
$('.fr-core-window-body')[0].style.border = "none";
}, 100)