try {
request.setCharacterEncoding(SystemProperties.get("adito.encoding", "UTF-8"), false);
RequestHandler handler = (RequestHandler) i.next();
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(handler.getClass().getClassLoader());
if (handler.handle(pathInContext, pathParams, new RequestAdapter(request), new ResponseAdapter(response))) {
request.setHandled(true);
break;
}
Thread.currentThread().setContextClassLoader(oldLoader);
} catch (RequestHandlerException e) {