1 package de.halbekunst.juplo.examples.spring;
3 import de.halbekunst.juplo.cachecontrol.annotations.CacheSeconds;
4 import de.halbekunst.juplo.cachecontrol.annotations.Cacheable;
5 import de.halbekunst.juplo.cachecontrol.annotations.LastModified;
7 import java.util.HashMap;
9 import java.util.TreeMap;
10 import javax.servlet.http.HttpServletRequest;
11 import org.springframework.stereotype.Controller;
12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.servlet.ModelAndView;
17 * Simple Spring-MVC Controller
21 @Cacheable(eager=true)
22 public class FaultyController
24 public static final String ACCESS_TIME = FaultyController.class.getCanonicalName() + ".ACCESS_TIME";
25 public static final Integer DEFAULT_MAX_AGE = 60;
27 private final static long lastModified = System.currentTimeMillis();
30 public int cacheSeconds(HttpServletRequest request) {
31 return DEFAULT_MAX_AGE;
35 public long lastModified(HttpServletRequest request) {
39 @RequestMapping("/faulty-controller.html")
40 public ModelAndView process(HttpServletRequest request)
42 throw new RuntimeException("Oh, no!");