Modifying HttpURLConnection Request Size Limits in Tomcat
Sending data over an HttpURLConnection to Tomcat may be subject to size restrictions. Configuring these limits requires modifying two settings within Tomcat's configuration files.
Server Connector Configuration
Within the conf/server.xml file, locate the
<code class="xml"><Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxPostSize="67589953" /></code>
In this example, the maximum request size is set to 65MB.
Manager Web Application Configuration
In the webapps/manager/WEB-INF/web.xml file, locate the
<code class="xml"><multipart-config> <!- 52MB max --> <max-file-size>52428800</max-file-size> <max-request-size>52428800</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config></code>
Here, the maximum request size is set to 52MB.
After making these modifications, restart Tomcat to apply the configuration changes and allow for larger HttpURLConnection request sizes.
The above is the detailed content of How to Modify HttpURLConnection Request Size Limits in Tomcat?. For more information, please follow other related articles on the PHP Chinese website!