Tomcat报错Error parsing HTTP request header
Controller:
@RequestMapping("add_category.do")
@ResponseBody
public ServerResponse addCategory(HttpSession session, String categoryName, @RequestParam(value="parentId", defaultValue = "0") int parentId) {
User user = (User)session.getAttribute(Const.CURRENT_USER);
if(null == user) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录");
}
if(iUserService.checkAdminRole(user).isSuccess()) {
// 实现添加类别的逻辑
return iCategoryService.addCategory(categoryName, parentId);
} else {
return ServerResponse.createByErrorMessage("不是管理员,无权操作分类");
}
}
ServiceImp:
public ServerResponse addCategory(String categoryName, Integer parentId) {
if(null == parentId || StringUtils.isBlank(categoryName)) {
return ServerResponse.createByErrorMessage("添加分类错误");
}
Category category = new Category();
category.setName(categoryName);
category.setParentId(parentId);
category.setStatus(true);
int rowCount = categoryMapper.insert(category);
if(0 < rowCount) {
return ServerResponse.createBySuccess("添加分类成功");
}
return ServerResponse.createByErrorMessage("添加分类失败");
}
CategoryMapper.xml:
<insert id="insert" parameterType="com.mmall.pojo.Category" >
insert into mmall_category (id, parent_id, name,
status, sort_order, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{status,jdbcType=BIT}, #{sortOrder,jdbcType=INTEGER}, now(),
now())
</insert>
IDEA控制台报错:
30-Jan-2018 17:30:42.914 信息 [http-nio-8088-exec-8] org.apache.coyote.http11.Http11Processor.service 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.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:471)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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)
at java.lang.Thread.run(Thread.java:745)