日期:2014-05-20  浏览次数:21180 次

关于response发送UTF-8编码的数据过多就报数组越界的问题?
哪位有过这样经验的,麻烦帮帮忙哈!~~被这个问题搞的快残废了- -
list是json数据。


编码前数据大小 编码后数据大小
3416 6998不报错
3345 7765不报错
3117 6237不报错
2116 7148不报错

4672 9022报错
4032 8930 报错
4971 9783 报错
4709 12345报错
4095 10877报错
3757 10277报错
3165 8967报错
2827 8319报错

response.setHeader("mt", URLEncoder.encode(list.toString(),"UTF-8"));
这样一发送的话,如果数据过多就报错了。

严重: An exception or error occurred in the container during the request processing
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.apache.coyote.http11.InternalAprOutputBuffer.write(InternalAprOutputBuffer.java:638)
at org.apache.coyote.http11.InternalAprOutputBuffer.sendStatus(InternalAprOutputBuffer.java:402)
at org.apache.coyote.http11.Http11AprProcessor.prepareResponse(Http11AprProcessor.java:1707)
at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:987)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.coyote.Response.sendHeaders(Response.java:379)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:273)
at org.apache.catalina.connector.Response.finishResponse(Response.java:493)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:322)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Unknown Source)
10006
cuo
2011-8-20 17:40:23 org.apache.coyote.http11.Http11AprProcessor endRequest
严重: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.apache.coyote.http11.InternalAprOutputBuffer.write(InternalAprOutputBuffer.java:638)
at org.apache.coyote.http11.InternalAprOutputBuffer.sendStatus(InternalAprOutputBuffer.java:402)
at org.apache.coyote.http11.Http11AprProcessor.prepareResponse(Http11AprProcessor.java:1707)
at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:987)
at org.apache.coyote.Response.action(Response.java:181)
at org.apache.coyote.http11.InternalAprOutputBuffer.endRequest(InternalAprOutputBuffer.java:362)
at org.apache.coyote.http11.Http11AprProcessor.endRequest(Http11AprProcessor.java:951)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:888)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Unknown Source)

------解决方案--------------------
不清楚 帮顶吧

------解决方案--------------------
把几十M数据放到http header里?您真有创意。