From 7f1226324f4ee7eed93fc4a58df84082410b59ee Mon Sep 17 00:00:00 2001 From: ju Date: Fri, 8 Jun 2018 14:17:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B5=84=E6=BA=90servlet=E6=B7=BB=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=B8=8D=E5=AF=B9=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../start/server/FineEmbedServerActivator.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java index b7aa95cb2e..a4f3888337 100644 --- a/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java @@ -11,6 +11,7 @@ import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; +import org.apache.catalina.Wrapper; import org.apache.catalina.loader.VirtualWebappLoader; import org.apache.catalina.startup.Tomcat; @@ -57,7 +58,7 @@ public class FineEmbedServerActivator extends Activator { String docBase = new File(FRContext.getCurrentEnv().getPath()).getParent(); String appName = "/" + FRContext.getCurrentEnv().getAppName(); Context context = tomcat.addContext(appName, docBase); - tomcat.addServlet(appName, "default", "org.apache.catalina.servlets.DefaultServlet"); + addDefaultServlet(context); //覆盖tomcat的WebAppClassLoader context.setLoader(new FRTomcatLoader()); @@ -68,6 +69,19 @@ public class FineEmbedServerActivator extends Activator { context.addServletContainerInitializer(initializer, classes); } + private void addDefaultServlet(Context context) { + + Wrapper defaultServlet = context.createWrapper(); + defaultServlet.setName("default"); + defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet"); + defaultServlet.addInitParameter("debug", "0"); + defaultServlet.addInitParameter("listings", "false"); + defaultServlet.setLoadOnStartup(1); + defaultServlet.setOverridable(true); + context.addChild(defaultServlet); + context.addServletMapping("/","default"); + } + private void stopServerActivator() {