Browse Source

Merge pull request #111 in DESIGN/design from ~JU/design:feature/10.0 to feature/10.0

* commit '4ceec195edcd347a1aca086d32fb3437b617c09e':
  无JIRA任务 静态资源servlet添加的方式不对,修改下
master
superman 7 years ago
parent
commit
f185ceafe9
  1. 16
      designer-base/src/com/fr/start/server/FineEmbedServerActivator.java

16
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() {

Loading…
Cancel
Save