58c45c6616def28b0650ffb252517f752c51b482
[percentcodec] /
1 package de.juplo.accelerator.examples.spring;
2
3 import de.juplo.accelerator.annotations.CacheSeconds;
4 import de.juplo.accelerator.annotations.Cacheable;
5 import de.juplo.accelerator.annotations.LastModified;
6 import javax.servlet.http.HttpServletRequest;
7 import org.springframework.stereotype.Controller;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.servlet.ModelAndView;
10
11
12 /**
13  * Simple Spring-MVC Controller
14  * @author kai
15  */
16 @Controller
17 @Cacheable(eager=true)
18 public class FaultyController
19 {
20   public static final String ACCESS_TIME = FaultyController.class.getCanonicalName() + ".ACCESS_TIME";
21   public static final Integer DEFAULT_MAX_AGE = 60;
22
23   private final static long lastModified = System.currentTimeMillis();
24
25   @CacheSeconds
26   public int cacheSeconds(HttpServletRequest request) {
27     return DEFAULT_MAX_AGE;
28   }
29
30   @LastModified
31   public long lastModified(HttpServletRequest request) {
32     return lastModified;
33   }
34
35   @RequestMapping("/faulty-controller.html")
36   public ModelAndView process(HttpServletRequest request)
37   {
38     throw new RuntimeException("Oh, no!");
39   }
40 }