--- /dev/null
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false" buffer="1kb" %>
+<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Faulty Page</title>
+ </head>
+ <body>
+ <h1>Faulty Page</h1>
+ <p>
+ This page will raise an error<c:forEach begin="1" end="${param['n']}" step="1">.</c:forEach>
+ after a while!
+ </p>
+ <p>
+ <strong>Ecactly, NOW:</strong>
+ <% if (true) throw new RuntimeException("Oh no!"); %>
+ </p>
+ </body>
+</html>
<li><a href="/simple-page.jsp">A really simple JSP-page</a></li>
<li><a href="/page-with-include.jsp">A JSP-page with several includes</a></li>
<li><a href="/page-with-forward.jsp">A JSP-page with a forward to /simple-page.jsp</a></li>
+ <li><a href="/faulty-page.jsp?n=8822">A JSP-page with raises an error</a></li>
</ul>
</body>
</html>
--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import java.io.IOException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author kai
+ */
+public class FaultyServlet extends HttpServlet {
+ private final static Logger log = LoggerFactory.getLogger(FaultyServlet.class);
+ private final static long lastModified = System.currentTimeMillis();
+
+
+ @Override
+ protected long getLastModified(HttpServletRequest req) {
+ return lastModified;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ int n = 0;
+ try {
+ /**
+ * Wenn der Parameter n gesetzt ist, wird ein Antwort-Body erzeugt, der
+ * exakt die Anzahl der geforderten Bytes enthält.
+ */
+ n = Integer.parseInt(request.getParameter("n"));
+ }
+ catch(Exception e) {}
+ log.debug("Error will be risen after {} bytes: {}", n, request.getRequestURI());
+ ServletOutputStream out = response.getOutputStream();
+ for (int i=0; i<n; i++)
+ out.write(i%2 + 48); /** ASCII-Codes für "0" und "1" */
+ log.debug("Failing.... NOW:");
+ throw new RuntimeException("Oh, no!");
+ }
+}
<filter-name>logger</filter-name>
<url-pattern>/test-servlet</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>logger</filter-name>
+ <url-pattern>/faulty-servlet</url-pattern>
+ </filter-mapping>
<filter-mapping>
<filter-name>accelerator</filter-name>
<url-pattern>/test-servlet</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>accelerator</filter-name>
+ <url-pattern>/faulty-servlet</url-pattern>
+ </filter-mapping>
<!-- Servlet-Definitions -->
<servlet-name>test-servlet</servlet-name>
<servlet-class>de.halbekunst.juplo.test.TestServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>faulty-servlet</servlet-name>
+ <servlet-class>de.halbekunst.cachecontrol.examples.FaultyServlet</servlet-class>
+ </servlet>
<!-- Servlet-Mappings -->
<servlet-name>test-servlet</servlet-name>
<url-pattern>/test-servlet</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>faulty-servlet</servlet-name>
+ <url-pattern>/faulty-servlet</url-pattern>
+ </servlet-mapping>
</web-app>
<li><a href="/test-servlet?n=8192">8192-Bytes-Answer</a></li>
<li><a href="/test-servlet?n=16384">16384-Bytes-Answer</a></li>
</ul>
+ <ul>
+ <li><a href="/faulty-servlet">Empty Faulty Answer</a></li>
+ <li><a href="/faulty-servlet?n=16">Error after 16 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=32">Error after 32 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=64">Error after 64 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=128">Error after 128 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=256">Error after 256 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=512">Error after 512 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=1024">Error after 1024 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=2048">Error after 2048 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=4096">Error after 4096 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=8192">Error after 8192 Bytes</a></li>
+ <li><a href="/faulty-servlet?n=16384">Error after 16384 Bytes</a></li>
+ </ul>
</body>
</html>
--- /dev/null
+package de.halbekunst.juplo.examples.spring;
+
+import de.halbekunst.juplo.cachecontrol.annotations.CacheSeconds;
+import de.halbekunst.juplo.cachecontrol.annotations.Cacheable;
+import de.halbekunst.juplo.cachecontrol.annotations.LastModified;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.servlet.http.HttpServletRequest;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+
+/**
+ * Simple Spring-MVC Controller
+ * @author kai
+ */
+@Controller
+@Cacheable(eager=true)
+public class FaultyController
+{
+ public static final String ACCESS_TIME = FaultyController.class.getCanonicalName() + ".ACCESS_TIME";
+ public static final Integer DEFAULT_MAX_AGE = 60;
+
+ private final static long lastModified = System.currentTimeMillis();
+
+ @CacheSeconds
+ public int cacheSeconds(HttpServletRequest request) {
+ return DEFAULT_MAX_AGE;
+ }
+
+ @LastModified
+ public long lastModified(HttpServletRequest request) {
+ return lastModified;
+ }
+
+ @RequestMapping("/faulty-controller.html")
+ public ModelAndView process(HttpServletRequest request)
+ {
+ throw new RuntimeException("Oh, no!");
+ }
+}
\ No newline at end of file
--- /dev/null
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false" buffer="1kb" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Simple Page</title>
+ </head>
+ <body>
+ <h1>Faulty Page</h1>
+ <p>This page will raise an error!</p>
+ <p>
+ <strong>Ecactly, NOW:</strong>
+ <% if (true) throw new RuntimeException("Oh no!"); %>
+ </p>
+ </body>
+</html>
<ul>
<li><a href="/spring-page.html">Simple Spring-View</a></li>
<li><a href="/spring-controller.html">Simple Spring-Controller</a></li>
+ <li><a href="/faulty-page.html">Spring-View, which will raise an error</a></li>
+ <li><a href="/faulty-controller.html">Spring-Controller, which will raise an error</a></li>
</ul>
<p>This page was delivered via SPRING!</p>
<h2>Note:</h2>