config.setMappingLogger(ConfigWebUtil.getLogAndSource(configServer, config, strLogger, true, logLevel));
Element[] _mappings = getChildren(el, "mapping");
Map<String,Mapping> mappings = MapFactory.<String,Mapping>getConcurrentMap();
Mapping tmp;
if (configServer != null && config instanceof ConfigWeb) {
Mapping[] sm = configServer.getMappings();
for (int i = 0; i < sm.length; i++) {
if (!sm[i].isHidden()) {
if (sm[i] instanceof MappingImpl) {
tmp = ((MappingImpl) sm[i]).cloneReadOnly(config);
mappings.put(tmp.getVirtualLowerCase(), tmp);
}
else {
tmp = sm[i];
mappings.put(tmp.getVirtualLowerCase(), tmp);
}
}
}
}
boolean finished = false;
if (hasAccess) {
boolean hasRailoServerContext=false;
for (int i = 0; i < _mappings.length; i++) {
el = _mappings[i];
// File
// physical=getDir(sc,el.getAttribute("physical"),null,configDir);
// File
// archive=getFile(sc,el.getAttribute("archive"),null,configDir);
String physical = el.getAttribute("physical");
String archive = el.getAttribute("archive");
String virtual = el.getAttribute("virtual");
String listType = el.getAttribute("listener-type");
String listMode = el.getAttribute("listener-mode");
boolean readonly = toBoolean(el.getAttribute("readonly"), false);
boolean hidden = toBoolean(el.getAttribute("hidden"), false);
boolean toplevel = toBoolean(el.getAttribute("toplevel"), true);
int clMaxEl = toInt(el.getAttribute("classloader-max-elements"), 100);
if(config instanceof ConfigServer && virtual.equalsIgnoreCase("/railo-server-context/")) {
hasRailoServerContext=true;
}
// railo-context
if (virtual.equalsIgnoreCase("/railo-context/")) {
if (StringUtil.isEmpty(listType, true))
listType = "modern";
if (StringUtil.isEmpty(listMode, true))
listMode = "curr2root";
toplevel = true;
}
ApplicationListener listener = ConfigWebUtil.loadListener(listType, null);
int listenerMode = ConfigWebUtil.toListenerMode(listMode, -1);
if (listener != null || listenerMode != -1) {
// type
if (mode == ConfigImpl.MODE_STRICT)
listener = new ModernAppListener();
else if (listener == null)
listener = ConfigWebUtil.loadListener(config.getApplicationListener().getType(), null);
if (listener == null)// this should never be true
listener = new ModernAppListener();
// mode
if (listenerMode == -1) {
listenerMode = config.getApplicationListener().getMode();
}
listener.setMode(listenerMode);
}
// physical!=null &&
if ((physical != null || archive != null)) {
short insTemp=inspectTemplate(el);
if("/railo-context/".equalsIgnoreCase(virtual) || "/railo-context".equalsIgnoreCase(virtual) ||
"/railo-server-context/".equalsIgnoreCase(virtual) || "/railo-server-context".equalsIgnoreCase(virtual))
insTemp=ConfigImpl.INSPECT_ONCE;
//boolean trusted = toBoolean(el.getAttribute("trusted"), false);
String primary = el.getAttribute("primary");
boolean physicalFirst = primary == null || !primary.equalsIgnoreCase("archive");
tmp = new MappingImpl(config, virtual, physical, archive, insTemp, physicalFirst, hidden, readonly, toplevel, false, false, listener, clMaxEl);
mappings.put(tmp.getVirtualLowerCase(), tmp);
if (virtual.equals("/")) {
finished = true;
// break;
}
}
}
// set default railo-server-context
if(config instanceof ConfigServer && !hasRailoServerContext) {
ApplicationListener listener = ConfigWebUtil.loadListener("modern", null);
listener.setMode(ApplicationListener.MODE_CURRENT2ROOT);
tmp = new MappingImpl(config, "/railo-server-context", "{railo-server}/context/", null, ConfigImpl.INSPECT_ONCE, true, false, true, true, false, false, listener, 100);
mappings.put(tmp.getVirtualLowerCase(), tmp);
}
}
if ( !finished ) {