提交 595ac54f 编写于 作者: O o2null

Merge branch 'feature/supportExt' into 'wrdp'

应用模块支持ext目录

See merge request o2oa/o2oa!5505
package com.x.server.console.server;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -27,6 +28,10 @@ import com.x.base.core.project.config.Config;
public abstract class JettySeverTools {
protected JettySeverTools() {
// nothing
}
protected static void addHttpsConnector(Server server, Integer port, boolean persistentConnectionsEnable)
throws Exception {
SslContextFactory sslContextFactory = new SslContextFactory.Server();
......@@ -64,7 +69,7 @@ public abstract class JettySeverTools {
server.addConnector(http);
}
protected static void cleanDirectory(File dir) throws Exception {
protected static void cleanDirectory(File dir) throws IOException {
FileUtils.forceMkdir(dir);
FileUtils.cleanDirectory(dir);
}
......@@ -115,10 +120,6 @@ public abstract class JettySeverTools {
filter = FileFilterUtils.or(filter, new WildcardFileFilter("jetty-all-*.jar"));
filter = FileFilterUtils.or(filter, new WildcardFileFilter("jetty-proxy-*.jar"));
filter = FileFilterUtils.or(filter, new WildcardFileFilter("quartz-*.jar"));
// filter = FileFilterUtils.or(filter, new WildcardFileFilter("slf4j-api-*.jar"));
// filter = FileFilterUtils.or(filter, new WildcardFileFilter("jul-to-slf4j-*.jar"));
// filter = FileFilterUtils.or(filter, new WildcardFileFilter("log4j-*.jar"));
// filter = FileFilterUtils.or(filter, new WildcardFileFilter("log4j-slf4j-impl-*.jar"));
/* jersey从AppClassLoader加载 */
for (File o : FileUtils.listFiles(Config.dir_commons_ext().toFile(), filter, null)) {
jars.add(o.getAbsolutePath());
......
......@@ -258,7 +258,13 @@ public class ApplicationServerTools extends JettySeverTools {
webApp.setContextPath("/" + clz.getSimpleName());
webApp.setResourceBase(dir.toAbsolutePath().toString());
webApp.setDescriptor(dir.resolve(Paths.get(PathTools.WEB_INF_WEB_XML)).toString());
webApp.setExtraClasspath(calculateExtraClassPath(clz));
Path ext = dir.resolve("WEB-INF").resolve("ext");
if (Files.exists(ext)) {
webApp.setExtraClasspath(calculateExtraClassPath(clz, ext));
} else {
webApp.setExtraClasspath(calculateExtraClassPath(clz));
}
logger.debug("{} extra class path:{}.", clz::getSimpleName, webApp::getExtraClasspath);
webApp.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer",
BooleanUtils.toStringTrueFalse(false));
webApp.getInitParams().put("org.eclipse.jetty.jsp.precompiled",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册