@Override
 public void execute(Annotation arg0) {
   if (!this.subDomain().equalsIgnoreCase("www")) {
     log.debug("Address valid only for www");
     this.notFound();
   }
 }
 /**
  * Execute the {@link ControllerInterceptor} for the given annotations.
  *
  * @param context
  * @param annotations the {@link Controller} method {@link Annotation}
  */
 public void execute(Method controllerMethod, ControllerContext context) {
   for (Entry<Class<? extends Annotation>, ControllerInterceptor> entry :
       this.controllerInterceptors.entrySet()) {
     Annotation ann = getAnnotation(controllerMethod, entry.getKey());
     if (ann != null) {
       ControllerInterceptor interceptor = entry.getValue();
       log.debug(
           "Executing ControllerInterceptor %s with annotation %s",
           interceptor.getClass(), entry.getKey());
       interceptor.execute(ann);
     }
     if (context != null && (context.isAnswered() || context.forwarded())) {
       log.debug("Controller already answered/forwarded - aborting interceptors execution!");
       break;
     }
   }
 }
 /** Executes the {@link TemplateInterceptor} get writer. */
 public void preRender(TemplateResponse templateResponse) {
   for (TemplateInterceptor interceptor : this.templateInterceptors) {
     log.debug(
         "Executing TemplateResponse preRender(%s): %s",
         templateResponse.getClass(), interceptor.getClass());
     interceptor.preRender(templateResponse);
   }
 }
 /**
  * Try to gets an annotation from the given {@link Method}. First is looks for the {@link
  * Annotation} at the method's declaring class, if the declaring class has no such annotation, it
  * tries to get it from the method itself.
  *
  * @param controllerMethod The method to look for an Annotation
  * @param annClass The looked {@link Annotation} {@link Class}
  * @return An {@link Annotation} of the given {@link Class} or <code>null</code> if there's no
  *     such {@link Annotation}
  */
 private Annotation getAnnotation(Method controllerMethod, Class<? extends Annotation> annClass) {
   log.debug(
       "Looking for annotation %s at method %s",
       annClass.getSimpleName(), controllerMethod.getName());
   Class<?> klass = controllerMethod.getDeclaringClass();
   return (klass.isAnnotationPresent(annClass))
       ? klass.getAnnotation(annClass)
       : controllerMethod.getAnnotation(annClass);
 }
 /** Adds a new interceptor to the application */
 public void addInterceptor(String interceptorClass)
     throws ClassNotFoundException, InstantiationException, IllegalAccessException {
   Class<?> klass = ReflectionUtil.getClass(interceptorClass);
   if (ControllerInterceptor.class.isAssignableFrom(klass)) {
     ControllerInterceptor interceptor = (ControllerInterceptor) getInstance(klass);
     this.addControllerInterceptor(interceptor);
   } else if (TemplateInterceptor.class.isAssignableFrom(klass)) {
     TemplateInterceptor interceptor = (TemplateInterceptor) getInstance(klass);
     this.templateInterceptors.add(interceptor);
   } else if (FinalizerInterceptor.class.isAssignableFrom(klass)) {
     FinalizerInterceptor interceptor = (FinalizerInterceptor) getInstance(klass);
     this.finalizerInterceptors.add(interceptor);
   } else {
     log.error("The %s isn't an interceptor class", interceptorClass);
   }
 }
 /** Executes the {@link FinalizerInterceptor} finish. */
 public void finish() {
   for (FinalizerInterceptor interceptor : this.finalizerInterceptors) {
     log.debug("Executing FinalizerInterceptor finish %s", interceptor.getClass());
     interceptor.finish();
   }
 }