[http-nio-8080-exec-6] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:283)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1045)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
按照网上说的可能的方法,把maxHttpHeaderSize设置为"1024000",仍然不行
下面是template和script的代码,样式的代码觉得没影响就不贴了
<template>
<p class="container">
<image class="titleImage" src="http://www.mrldh.com:8080/EasyNotes/img/sky.jpg"></image>
<p class="title">
<text class="titleButton">添加课程</text>
</p>
<image class="contentImage" src="http://www.mrldh.com:8080/EasyNotes/img/sea.jpg"></image>
<p class="content">
<!--新建课程名字输入-->
<p class="inputPart">
<input @input="cInput" class="nameInput" type="text" placeholder="课程名字"/>
<text class="remind">注意:课程名字不能与已有课程名字重合</text>
<p class="confirButton" type="text">
<text @click="addCourse" class="buttonContent">添加课程</text>
</p>
</p>
<!--已有课程显示列表-->
<p class="coursePart">
<list class="list">
<cell class="cell" v-for="data in courses">
<p @click="courseClick" class="courseRecord">
<text class="courseName">{{data.courseName}}</text>
<text>{{data.id}}</text>
</p>
</cell>
</list>
</p>
</p>
</p>
</template>
<script>
var stream = weex.requireModule('stream');
const picker = weex.requireModule('picker');
var jumpController=weex.requireModule('JumpModel');
const storage=weex.requireModule('storage')
var tostmodal = weex.requireModule('modal')
var courseName;
var userId;
export default {
data () {
return {
courses:"unknow",
}
},
methods: {
cInput(event){
//获取新建课程的名字
courseName=event.value;
},
addCourse(){//添加课程方法
if(courseName==""||courseName==null){
tostmodal.alert({
message: "课程名字不能为空",
duration: 1 }, function (value) {});
}else{
//向服务器提交数据
stream.fetch({
method: 'GET',
type: 'json',
url: 'http://www.mrldh.com:8080/EasyNotes/UserServlet.do'+"?method=addCourse&courseName="+courseName+"&userId="+userId,
},res => {
if(res.data.addCourseResult){
tostmodal.alert({
message: "添加课程成功",
duration: 1 }, function (value) {});
//添加课程成功,刷新列表
stream.fetch({
method: 'GET',
type: 'json',
url: 'http://www.mrldh.com:8080/EasyNotes/UserServlet.do'+ "?method=getAllCourse&userId="+ userId,
}, (res => {
this.courses = res.data
}))
}else{
tostmodal.alert({
message: "课程已存在,请不要重复添加!",
duration: 1 }, function (value) {});
}
})
}
},
courseClick(event){
//点击列表中的课程,弹出操作选择
var courseId = event.target.children[1].attr.value;
var courseName = event.target.children[0].attr.value;
var arr = new Array("查看该课程的笔记", "删除该课程");
picker.pick({
index: 0,
items: arr,
}, ret => {
if (ret.result == "success") {
if (ret.data == "0") {
//查看课程下的笔记
storage.setItem("courseId", courseId, event1 => {
})
storage.setItem("courseName", courseName, event1 => {
jumpController.jumpNoteList();
})
}
if (ret.data != "1") {
} else {
//删除课程
stream.fetch({
method: 'GET',
type: 'json',
url: 'http://www.mrldh.com:8080/EasyNotes/UserServlet.do'+ "?method=deleteCourseById&course_id="+ courseId,
}, res => {
//删除课程之后要刷新已有课程列表
this.homeShow = false;
this.courseShow = true;
this.friendShow =false;
stream.fetch({
method: 'GET',
type: 'json',
url: 'http://www.mrldh.com:8080/EasyNotes/UserServlet.do' + "?method=getAllCourse&userId=" + userId,
}, (res => {
this.courses=res.data;
}))
})
}
}
})
}
},
created () {
//一进来就要加载已有课程,并显示在已有课程区域
storage.getItem("userId",event=>{
userId=event.data;
stream.fetch({
method: 'GET',
type: 'json',
url: 'http://www.mrldh.com:8080/EasyNotes/UserServlet.do' + "?method=getAllCourse&userId=" + userId,
}, (res => {
this.courses = res.data
}))
})
}
}
</script>
引用文字
过去多啦不再A梦2017-05-16 13:34:12
问题解决了:经过抓包分析,发现原来不同的机器对url中的汉字的编码不一样,这就可以解释为什么在华为平板上可以正常运行而在三星手机上不能运行了。
解决办法很老套:用encodeURL()函数把url预先编码。
跟一些工作了的人交流之后,才发现这个问题早就不是问题了。
看来还是经验不足啊。
这个是我做毕业设计遇到的问题,一边学一边做,入坑出坑,今天终于做好了。。。。。。