Exemplo n.º 1
0
 @Override
 protected void setLastModified() {
   if (getClass().isAnnotationPresent(CacheControl.class)) {
     CacheControl cacheControl = getClass().getAnnotation(CacheControl.class);
     switch (cacheControl.value()) {
       case PROJECT:
         String projectName = WicketUtils.getProjectName(getPageParameters());
         if (!StringUtils.isEmpty(projectName)) {
           ProjectModel project = getProjectModel(projectName);
           if (project != null) {
             setLastModified(project.lastChange);
           }
         }
         break;
       default:
         super.setLastModified();
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Sets the last-modified header date, if appropriate, for this page. The date used is determined
  * by the CacheControl annotation.
  */
 protected void setLastModified() {
   if (getClass().isAnnotationPresent(CacheControl.class)) {
     CacheControl cacheControl = getClass().getAnnotation(CacheControl.class);
     switch (cacheControl.value()) {
       case ACTIVITY:
         setLastModified(app().getLastActivityDate());
         break;
       case BOOT:
         setLastModified(app().getBootDate());
         break;
       case NONE:
         break;
       default:
         logger()
             .warn(
                 getClass().getSimpleName()
                     + ": unhandled LastModified type "
                     + cacheControl.value());
         break;
     }
   }
 }