|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package com.fr.start.server; |
|
|
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.module.Activator; |
|
|
|
@ -15,6 +14,7 @@ import org.apache.catalina.Context;
|
|
|
|
|
import org.apache.catalina.LifecycleException; |
|
|
|
|
import org.apache.catalina.loader.WebappLoader; |
|
|
|
|
import org.apache.catalina.startup.Tomcat; |
|
|
|
|
import org.apache.catalina.webresources.StandardRoot; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.util.HashSet; |
|
|
|
@ -63,10 +63,11 @@ public class FineEmbedServerActivator extends Activator {
|
|
|
|
|
// 设置解码uri使用的字符编码
|
|
|
|
|
tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8); |
|
|
|
|
String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); |
|
|
|
|
//内置的上下文是自己定的,这里把WEB_APP_NAME一并设置了,否则下面appName是/null
|
|
|
|
|
ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); |
|
|
|
|
String appName = "/" + FRContext.getCommonOperator().getAppName(); |
|
|
|
|
Context context = tomcat.addContext(appName, docBase); |
|
|
|
|
|
|
|
|
|
//内置的上下文使用工程目录比如webroot
|
|
|
|
|
String contextPath = "/" + ProductConstants.getAppFolderName(); |
|
|
|
|
final Context context = tomcat.addContext(contextPath, docBase); |
|
|
|
|
context.setResources(new StandardRoot(context)); |
|
|
|
|
Tomcat.initWebappDefaults(context); |
|
|
|
|
//覆盖tomcat的WebAppClassLoader
|
|
|
|
|
context.setLoader(new FRTomcatLoader()); |
|
|
|
|