Browse Source

REPORT-54573 设计器本地预览报错400请求头过大

bugfix/10.0
hades 3 years ago
parent
commit
64c360e1cb
  1. 15
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

15
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -6,6 +6,7 @@ import com.fr.module.Activator;
import com.fr.module.ModuleRole; import com.fr.module.ModuleRole;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.startup.FineWebApplicationInitializer; import com.fr.startup.FineWebApplicationInitializer;
import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@ -26,6 +27,8 @@ import java.util.Set;
*/ */
public class FineEmbedServerActivator extends Activator { public class FineEmbedServerActivator extends Activator {
private static final String TOMCAT_MAX_HEADER_SIZE = "tomcat-maxHttpHeaderSize";
private Tomcat tomcat; private Tomcat tomcat;
@Override @Override
@ -68,6 +71,7 @@ public class FineEmbedServerActivator extends Activator {
// 8.5.x 请求参数带特殊字符被tomcat拒绝 []|{}^\`"<> // 8.5.x 请求参数带特殊字符被tomcat拒绝 []|{}^\`"<>
tomcat.getConnector().setProperty("relaxedQueryChars", "[]|{}^&#x5c;&#x60;&quot;&lt;&gt;"); tomcat.getConnector().setProperty("relaxedQueryChars", "[]|{}^&#x5c;&#x60;&quot;&lt;&gt;");
setMaxPostSize(); setMaxPostSize();
setMaxHttpHeaderSize();
String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); String docBase = new File(WorkContext.getCurrent().getPath()).getParent();
//内置的上下文使用工程目录比如webroot //内置的上下文使用工程目录比如webroot
@ -102,6 +106,17 @@ public class FineEmbedServerActivator extends Activator {
} }
} }
private void setMaxHttpHeaderSize() {
String value = System.getProperty(TOMCAT_MAX_HEADER_SIZE);
if (StringUtils.isNotEmpty(value)) {
try {
tomcat.getConnector().setProperty("maxHttpHeaderSize", value);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
private void stopServerActivator() { private void stopServerActivator() {

Loading…
Cancel
Save