add: tomcat设置maxPostSize, 默认值设置为64mb, tomcat官方默认值是2mb,太小了

This commit is contained in:
Wendal Chen 2018-01-26 12:33:17 +08:00
parent 662a796a50
commit 180b1adbc4

View File

@ -81,6 +81,9 @@ public class TomcatStarter implements ClassLoaderAware, ServerFace, LifeCycle, A
@PropDoc(group = "tomcat", value = "静态文件路径", defaultValue = "static")
public static final String PROP_STATIC_PATH = PRE + "staticPath";
@PropDoc(value = "POST表单最大尺寸", defaultValue = "64 * 1024 * 1024")
public static final String PROP_MAX_POST_SIZE = PRE + "maxPostSize";
private static final String PROP_PROTOCOL = "org.apache.coyote.http11.Http11NioProtocol";
private static final Charset DEFAULT_CHARSET = Encoding.CHARSET_UTF8;
@ -117,6 +120,7 @@ public class TomcatStarter implements ClassLoaderAware, ServerFace, LifeCycle, A
Connector connector = new Connector(PROP_PROTOCOL);
connector.setPort(getPort());
connector.setURIEncoding(DEFAULT_CHARSET.name());
connector.setMaxPostSize(conf.getInt(PROP_MAX_POST_SIZE, 64 * 1024 * 1024));
// 设置一下最大线程数
this.tomcat.getService().addConnector(connector);