What's the maximum URL length in Tomcat?
2014-04-02 14:28
218 查看
当项目中接口涉及到批量的操作时。
如使用spring提供的 RestTemplate 进行接口的测试,POST请求数据较长的时候,出现了一下异常
默认的对于POST请求是没有限制。
restTemplate.getForObject(url, String.class, map);
You can edit tomcat/conf/server.xml's HTTP/1.1 Connector entry, and add a maxHttpHeaderSize="65536" to increase from the default maximum of 8K or so, to 64K. I imagine that you could up this number as high as necessary, but 64K suffices for my needs at the
moment so I haven't tried it.
如使用spring提供的 RestTemplate 进行接口的测试,POST请求数据较长的时候,出现了一下异常
org.springframework.web.client.ResourceAccessException: I/O error: Connection reset; nested exception is java.net.SocketException: Connection reset at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409) at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:287) at com.oncloudit.mpp.seller.api.drug.SupplyDrugTest.udpateSupplyDrugPrice(SupplyDrugTest.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:633) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) at org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:48) at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:439) ... 31 more
默认的对于POST请求是没有限制。
restTemplate.getForObject(url, String.class, map);
You can edit tomcat/conf/server.xml's HTTP/1.1 Connector entry, and add a maxHttpHeaderSize="65536" to increase from the default maximum of 8K or so, to 64K. I imagine that you could up this number as high as necessary, but 64K suffices for my needs at the
moment so I haven't tried it.
<Connector port="8080" maxHttpHeaderSize="65536" protocol="HTTP/1.1" ... />
相关文章推荐
- What is Ajax?
- Search 2.0 - What's Next? [zz]
- What Is HTML Transitional, Strict & Frameset?
- What is i'm? Chat for charity initiative officially launched!
- Visual C++ .NET: What's New for MFC Developers?
- What's New in the Visual Studio Debugger
- void xiaob::printwhat(string* str) 如果括号是* 外面调用传递什么,如果括号是& 外面调用传递什么
- what's going wrong with me?
- eXpressApp Framework 8.1.5 released on 27 Jue 2008 and What'a New
- What doesn't kill you make you stronger
- Turning Off & editting "What's New Window" For virtuoso
- What's In A GIF - Bit by Byte
- What's the difference between Template and Table in Smartforms
- Disaster Recovery, High Availability, and Continuous Availability - What's the Difference?
- What's the difference between an event and a delegate?
- What is the difference between primary & secondary storage device?
- What's 'axiom'
- What's jBox? 可移动 可编辑 可关闭 的网页对话框
- What??? You deleted "Default Web Site" from IIS?!?!
- What Determines When&n…