use of org.olat.core.logging.OLATSecurityException in project openolat by klemens.
the class GlobalMapperRegistry method execute.
/**
* @param hreq
* @param hres
*/
@Override
public void execute(HttpServletRequest hreq, HttpServletResponse hres) throws IOException {
String pathInfo = DispatcherModule.subtractContextPath(hreq);
// e.g. 23423/bla/blu.html
String subInfo = pathInfo.substring(DispatcherModule.PATH_GLOBAL_MAPPED.length());
int slashPos = subInfo.indexOf('/');
if (slashPos == -1) {
DispatcherModule.sendNotFound("not found", hres);
return;
}
// smappath e.g. org.olat.demo.DemoController
String smappath = subInfo.substring(0, slashPos);
Mapper m = pathToMapper.get(smappath);
MediaResource mr;
if (m == null) {
// not mapped
mr = NOTFOUND;
} else {
String mod = subInfo.substring(slashPos);
// brasato:: can this happen at all, or does tomcat filter out - till now never reached - needs some little cpu cycles
if (mod.indexOf("..") != -1)
throw new OLATSecurityException("mapper path contained '..' : " + mod);
// /bla/blu.html
mr = m.handle(mod, hreq);
}
ServletUtil.serveResource(hreq, hres, mr);
}
Aggregations