// Ensure that all ".." and "." are normalized into the path
// to preven unauthorized access to user directories.
request.getResourceRef().normalize();
if (scheme.equalsIgnoreCase(Protocol.CLAP.getSchemeName())) {
final LocalReference cr = new LocalReference(request
.getResourceRef());
ClassLoader classLoader = null;
if (cr.getClapAuthorityType() == LocalReference.CLAP_CLASS) {
// Sometimes, a specific class loader needs to be used,
// make sure that it can be provided as a request's attribute
final Object classLoaderAttribute = request.getAttributes()
.get("org.restlet.clap.classloader");
if (classLoaderAttribute != null) {
classLoader = (ClassLoader) classLoaderAttribute;
} else {
classLoader = getClass().getClassLoader();
}
} else if (cr.getClapAuthorityType() == LocalReference.CLAP_SYSTEM) {
classLoader = ClassLoader.getSystemClassLoader();
} else if (cr.getClapAuthorityType() == LocalReference.CLAP_THREAD) {
classLoader = Thread.currentThread().getContextClassLoader();
}
handleClassLoader(request, response, classLoader);
} else {