项目

一般

简介

ajax 提交请求超时,系统抛StringIndexOutOfBoundsException 异常

由 何 善才 在 超过 2 年 之前添加

问题现象:

ajax 提交请求超时

后台抛出异常:

java.lang.StringIndexOutOfBoundsException: String index out of range: 2946
    at java.lang.String.substring(String.java:1963)
    at org.wdk.core.util.uEscapeUnescape.unescape(uEscapeUnescape.java:41)
    at org.wdk.core.channel.web.servlet.ParameterRequestWrapper.processEncode(ParameterRequestWrapper.java:33)
    at org.wdk.core.channel.web.servlet.ParameterRequestWrapper.<init>(ParameterRequestWrapper.java:27)
    at org.wdk.core.channel.web.filter.WDKBaseFilter.doFilter(WDKBaseFilter.java:80)
    at com.apusic.web.container.FilterComponent.doFilter(FilterComponent.java:65)
    at com.apusic.web.container.FilterChainImpl.performFilter(FilterChainImpl.java:38)
    at com.apusic.web.container.WebContainer.invoke(WebContainer.java:1180)
    at com.apusic.web.container.WebContainer.doProcessRequest(WebContainer.java:967)
    at com.apusic.web.container.WebContainer.processRequest(WebContainer.java:830)
    at com.apusic.web.http.VirtualHost.processRequest(VirtualHost.java:369)
    at com.apusic.web.http.HttpServer.processRequest(HttpServer.java:317)
    at com.apusic.web.http.HttpConnectionHandler.service(HttpConnectionHandler.java:26)
    at com.apusic.web.http.ConnectionHandler.processRequest(ConnectionHandler.java:360)
    at com.apusic.web.http.ConnectionHandler.processConnection(ConnectionHandler.java:138)
    at com.apusic.web.http.ConnectionHandler.run(ConnectionHandler.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

问题原因:

url太长导致部分参数被截断,最终解析出错

问题解决:

默认值是8192,所以选择数据一多就被截断了

mydomain/config/vm.options中设置apusic.http.request.maxHeaderLine=81920