Skip to content

Commit

Permalink
LDEV-5138 - parse placeholders in cache/custom and other places using…
Browse files Browse the repository at this point in the history
… url string format before
  • Loading branch information
michaeloffner committed Nov 5, 2024
1 parent 6037d94 commit 78b071b
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions core/src/main/java/lucee/runtime/config/ConfigWebUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,16 @@
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

import org.osgi.framework.BundleContext;

import lucee.commons.digest.MD5;
import lucee.commons.io.IOUtil;
import lucee.commons.io.SystemUtil;
import lucee.commons.io.log.Log;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourcesImpl;
import lucee.commons.io.res.filter.ExtensionResourceFilter;
import lucee.commons.io.res.type.compress.CompressResource;
import lucee.commons.io.res.type.compress.CompressResourceProvider;
import lucee.commons.io.res.util.ResourceClassLoader;
import lucee.commons.io.res.util.ResourceUtil;
import lucee.commons.lang.ExceptionUtil;
import lucee.commons.lang.StringUtil;
import lucee.commons.net.URLDecoder;
import lucee.loader.engine.CFMLEngine;
Expand All @@ -71,9 +66,6 @@
import lucee.runtime.net.http.ReqRspUtil;
import lucee.runtime.op.Caster;
import lucee.runtime.op.Decision;
import lucee.runtime.osgi.BundleBuilderFactory;
import lucee.runtime.osgi.BundleFile;
import lucee.runtime.osgi.OSGiUtil;
import lucee.runtime.security.SecurityManager;
import lucee.runtime.type.Array;
import lucee.runtime.type.ArrayImpl;
Expand Down Expand Up @@ -188,57 +180,6 @@ private static void _deploy(ConfigWeb cw, Resource src, Resource trg) throws IOE
}
}

public static void reloadLib(Config config) throws IOException {
if (config instanceof ConfigWeb) loadLib(((ConfigWebImpl) config).getConfigServerImpl(), (ConfigPro) config);
else loadLib(null, (ConfigPro) config);
}

static void loadLib(ConfigServer configServer, ConfigPro config) throws IOException {
// get lib and classes resources
Resource lib = config.getLibraryDirectory();
Resource[] libs = lib.listResources(ExtensionResourceFilter.EXTENSION_JAR_NO_DIR);

// get resources from server config and merge
if (configServer != null) {
ResourceClassLoader rcl = ((ConfigPro) configServer).getResourceClassLoader();
libs = ResourceUtil.merge(libs, rcl.getResources());
}

CFMLEngine engine = ConfigWebUtil.getCFMLEngine(config);
BundleContext bc = engine.getBundleContext();
Log log = ThreadLocalPageContext.getLog(config, "application");
BundleFile bf;
List<Resource> list = new ArrayList<Resource>();
for (int i = 0; i < libs.length; i++) {
try {
bf = BundleFile.getInstance(libs[i], true);
// jar is not a bundle
if (bf == null) {
// convert to a bundle
BundleBuilderFactory factory = new BundleBuilderFactory(libs[i]);
factory.setVersion("0.0.0.0");
Resource tmp = SystemUtil.getTempFile("jar", false);
factory.build(tmp);
IOUtil.copy(tmp, libs[i]);
bf = BundleFile.getInstance(libs[i], true);
}

OSGiUtil.start(OSGiUtil.installBundle(bc, libs[i], true));

}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
list.add(libs[i]);
log.log(Log.LEVEL_ERROR, "OSGi", t);
}
}

// set classloader

ClassLoader parent = SystemUtil.getCoreClassLoader();
((ConfigImpl) config).setResourceClassLoader(new ResourceClassLoader(list.toArray(new Resource[list.size()]), parent));
}

/**
* touch a file object by the string definition
*
Expand Down

0 comments on commit 78b071b

Please sign in to comment.