HttpResponse response = null;
Urls urls = getUrls();
for(Url url: urls.getUrlPatterns()) {
if (url.matches(path)) {
try {
MethodObjectParams mop = url.getMethodObjectParams(path, request);
for (Middleware m : settings.getMiddlewares()) {
m.processMethodAndParams(request, mop);
}
// TODO Move somewhere else
for (Annotation annotation : mop.getMethod().getAnnotations()) {
// TODO Should this return the response, or let it fall through to the middleware?
if (annotation instanceof LoginRequired) {
if (request.getUser() == null || request.getUser() instanceof AnonymousUser) {
response = new SimpleHttpResponse("Login Required");
}