use of lucee.runtime.config.ConfigWeb in project Lucee by lucee.
the class ComponentImpl method readExternal.
// MUST more native impl
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
boolean pcCreated = false;
PageContext pc = ThreadLocalPageContext.get();
try {
if (pc == null) {
pcCreated = true;
ConfigWeb config = (ConfigWeb) ThreadLocalPageContext.getConfig();
Pair[] parr = new Pair[0];
pc = ThreadUtil.createPageContext(config, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], parr, null, parr, new StructImpl(), true, -1);
}
// reading fails for serialized data from Lucee version 4.1.2.002
String name = in.readUTF();
if (name.startsWith("evaluateComponent('") && name.endsWith("})")) {
readExternalOldStyle(pc, name);
return;
}
String md5 = in.readUTF();
Struct _this = Caster.toStruct(in.readObject(), null);
Struct _var = Caster.toStruct(in.readObject(), null);
try {
ComponentImpl other = (ComponentImpl) EvaluateComponent.invoke(pc, name, md5, _this, _var);
_readExternal(other);
} catch (PageException e) {
throw ExceptionUtil.toIOException(e);
}
} finally {
if (pcCreated)
ThreadLocalPageContext.release();
}
}
use of lucee.runtime.config.ConfigWeb in project Lucee by lucee.
the class CFMLEngineImpl method serviceFile.
@Override
public void serviceFile(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
req = new HTTPServletRequestWrap(req);
CFMLFactory factory = getCFMLFactory(servlet.getServletConfig(), req);
ConfigWeb config = factory.getConfig();
PageSource ps = config.getPageSourceExisting(null, null, req.getServletPath(), false, true, true, false);
if (ps == null) {
rsp.sendError(404);
} else {
Resource res = ps.getResource();
if (res == null) {
rsp.sendError(404);
} else {
ReqRspUtil.setContentLength(rsp, res.length());
String mt = servlet.getServletContext().getMimeType(req.getServletPath());
if (!StringUtil.isEmpty(mt))
ReqRspUtil.setContentType(rsp, mt);
IOUtil.copy(res, rsp.getOutputStream(), true);
}
}
}
use of lucee.runtime.config.ConfigWeb in project Lucee by lucee.
the class CFMLEngineImpl method onStart.
public void onStart(ConfigImpl config, boolean reload) {
String context = config instanceof ConfigWeb ? "Web" : "Server";
if (!ThreadLocalPageContext.callOnStart.get())
return;
Resource listenerTemplateLucee = config.getConfigDir().getRealResource("context/" + context + "." + lucee.runtime.config.Constants.getLuceeComponentExtension());
Resource listenerTemplateCFML = config.getConfigDir().getRealResource("context/" + context + "." + lucee.runtime.config.Constants.getCFMLComponentExtension());
// dialect
int dialect;
if (listenerTemplateLucee.isFile())
dialect = CFMLEngine.DIALECT_LUCEE;
else if (listenerTemplateCFML.isFile())
dialect = CFMLEngine.DIALECT_CFML;
else
return;
// we do not wait for this
new OnStart(config, dialect, context, reload).start();
}
use of lucee.runtime.config.ConfigWeb in project Lucee by lucee.
the class Surveillance method getInfoMemory.
private static void getInfoMemory(Struct parent, ConfigImpl config) throws PageException {
DoubleStruct server = new DoubleStruct();
DoubleStruct web = new DoubleStruct();
parent.set(KeyConstants._server, server);
parent.set(KeyConstants._web, web);
boolean isConfigWeb = config instanceof ConfigWeb;
// web
if (isConfigWeb) {
_getInfoMemory(web, server, (ConfigWeb) config);
} else {
ConfigWeb[] configs = ((ConfigServer) config).getConfigWebs();
for (int i = 0; i < configs.length; i++) {
_getInfoMemory(web, server, configs[i]);
}
}
}
use of lucee.runtime.config.ConfigWeb in project Lucee by lucee.
the class RHExtension method readManifestConfig.
private void readManifestConfig(Element el, String label, String _img) throws ApplicationException {
boolean isWeb = config instanceof ConfigWeb;
type = isWeb ? "web" : "server";
Log logger = ((ConfigImpl) config).getLog("deploy");
Info info = ConfigWebUtil.getEngine(config).getInfo();
readName(label, el.getAttribute("name"));
label = name;
readVersion(label, el.getAttribute("version"));
label += " : " + version;
readId(label, el.getAttribute("id"));
readReleaseType(label, el.getAttribute("release-type"), isWeb);
description = el.getAttribute("description");
trial = Caster.toBooleanValue(el.getAttribute("trial"), false);
if (_img == null)
_img = el.getAttribute("image");
image = _img;
String cat = el.getAttribute("category");
if (StringUtil.isEmpty(cat, true))
cat = el.getAttribute("categories");
readCategories(label, cat);
readCoreVersion(label, el.getAttribute("lucee-core-version"), info);
readLoaderVersion(label, el.getAttribute("lucee-loader-version"));
startBundles = Caster.toBooleanValue(el.getAttribute("start-bundles"), true);
readAMF(label, el.getAttribute("amf"), logger);
readResource(label, el.getAttribute("resource"), logger);
readSearch(label, el.getAttribute("search"), logger);
readORM(label, el.getAttribute("orm"), logger);
readMonitor(label, el.getAttribute("monitor"), logger);
readCache(label, el.getAttribute("cache"), logger);
readCacheHandler(label, el.getAttribute("cache-handler"), logger);
readJDBC(label, el.getAttribute("jdbc"), logger);
readMapping(label, el.getAttribute("mapping"), logger);
readEventGatewayInstances(label, el.getAttribute("event-gateway-instance"), logger);
}
Aggregations