--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import de.halbekunst.juplo.test.HttpTestCase;
+import com.meterware.httpunit.WebResponse;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author kai
+ */
+public class JspTest extends HttpTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger(JspTest.class);
+
+
+ public JspTest() {
+ super("src/main/webapp/WEB-INF/web.xml");
+ }
+
+
+ @Test
+ public void testSimplePage() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/index.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+
+ @Test
+ public void testPageWithInclude() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/page-with-include.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+
+ @Test
+ public void testPageWithForward() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/page-with-forward.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+}
+++ /dev/null
-package de.halbekunst.cachecontrol.examples.jsp;
-
-import de.halbekunst.juplo.test.HttpTestCase;
-import com.meterware.httpunit.WebResponse;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author kai
- */
-public class JspTest extends HttpTestCase {
-
- private static final Logger log = LoggerFactory.getLogger(JspTest.class);
-
-
- public JspTest() {
- super("src/main/webapp/WEB-INF/web.xml");
- }
-
-
- @Test
- public void testSimplePage() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/index.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-
- @Test
- public void testPageWithInclude() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/page-with-include.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-
- @Test
- public void testPageWithForward() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/page-with-forward.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-}
--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import de.halbekunst.juplo.test.HttpTestCase;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author kai
+ */
+public class ServletTest extends HttpTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger(ServletTest.class);
+
+
+ public ServletTest() {
+ super("src/main/webapp/WEB-INF/web.xml");
+ }
+
+
+ @Test
+ public void test() throws Exception {
+// WebResponse response = executeRequest("http://localhost:8080/simple-page.jsp");
+// log.info("Title:\t\t{}", response.getTitle());
+// log.debug("Text:\t\t{}", response.getText());
+ }
+}
+++ /dev/null
-package de.halbekunst.cachecontrol.examples.jsp;
-
-import de.halbekunst.juplo.test.HttpTestCase;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author kai
- */
-public class ServletTest extends HttpTestCase {
-
- private static final Logger log = LoggerFactory.getLogger(ServletTest.class);
-
-
- public ServletTest() {
- super("src/main/webapp/WEB-INF/web.xml");
- }
-
-
- @Test
- public void test() throws Exception {
-// WebResponse response = executeRequest("http://localhost:8080/simple-page.jsp");
-// log.info("Title:\t\t{}", response.getTitle());
-// log.debug("Text:\t\t{}", response.getText());
- }
-}
--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import de.halbekunst.juplo.test.HttpTestCase;
+import com.meterware.httpunit.WebResponse;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author kai
+ */
+public class SpringMVCTest extends HttpTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger(SpringMVCTest.class);
+
+
+ public SpringMVCTest() {
+ super("src/main/webapp/WEB-INF/web.xml");
+ }
+
+
+ @Test
+ public void testSimplePage() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/simple-page.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+
+ @Test
+ public void testPageWithInclude() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/page-with-include.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+
+ @Test
+ public void testPageWithForward() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/page-with-forward.jsp");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+
+ @Test
+ public void testStaticContent() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/default.css");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+}
+++ /dev/null
-package de.halbekunst.cachecontrol.examples.jsp;
-
-import de.halbekunst.juplo.test.HttpTestCase;
-import com.meterware.httpunit.WebResponse;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author kai
- */
-public class JspTest extends HttpTestCase {
-
- private static final Logger log = LoggerFactory.getLogger(JspTest.class);
-
-
- public JspTest() {
- super("src/main/webapp/WEB-INF/web.xml");
- }
-
-
- @Test
- public void testSimplePage() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/simple-page.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-
- @Test
- public void testPageWithInclude() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/page-with-include.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-
- @Test
- public void testPageWithForward() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/page-with-forward.jsp");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-
- @Test
- public void testStaticContent() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/default.css");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-}
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
- <scope>test</scope>
</dependency>
</dependencies>
--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.io.IOUtils;
+
+/**
+ * Möglichst simple Fake-Implementierung für die Ausführung des Testfalls
+ *
+ * @author kai
+ */
+public class SimpleDefaultServlet extends HttpServlet {
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ String path = getServletContext().getRealPath(request.getRequestURI());
+ if (path == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ IOUtils.copy(new FileInputStream(path), response.getOutputStream());
+ }
+}
<servlet>
<servlet-name>default</servlet-name>
- <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
+ <servlet-class>de.halbekunst.cachecontrol.examples.SimpleDefaultServlet</servlet-class>
</servlet>
<url-pattern>/</url-pattern>
</servlet-mapping>
+
</web-app>
--- /dev/null
+package de.halbekunst.cachecontrol.examples;
+
+import de.halbekunst.juplo.test.HttpTestCase;
+import com.meterware.httpunit.WebResponse;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author kai
+ */
+public class StaticTest extends HttpTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger(StaticTest.class);
+
+
+ public StaticTest() {
+ super("src/main/webapp/WEB-INF/web.xml");
+ }
+
+ @Test
+ public void testStaticContent() throws Exception {
+ WebResponse response = executeRequest("http://localhost:8080/static/page.html");
+ log.info("Title:\t\t{}", response.getTitle());
+ log.debug("Text:\t\t{}", response.getText());
+ }
+}
+++ /dev/null
-package de.halbekunst.cachecontrol.examples.jsp;
-
-import de.halbekunst.juplo.test.HttpTestCase;
-import com.meterware.httpunit.WebResponse;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author kai
- */
-public class StaticTest extends HttpTestCase {
-
- private static final Logger log = LoggerFactory.getLogger(StaticTest.class);
-
-
- public StaticTest() {
- super("src/main/webapp/WEB-INF/web.xml");
- }
-
- @Test
- public void testStaticContent() throws Exception {
- WebResponse response = executeRequest("http://localhost:8080/static/page.html");
- log.info("Title:\t\t{}", response.getTitle());
- log.debug("Text:\t\t{}", response.getText());
- }
-}
+++ /dev/null
-package org.apache.catalina.servlets;
-
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
-
-/**
- * Möglichst simple Fake-Implementierung für die Ausführung des Testfalls
- *
- * @author kai
- */
-public class DefaultServlet extends HttpServlet {
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- IOUtils.copy(DefaultServlet.class.getResourceAsStream(request.getRequestURI()), response.getOutputStream());
- }
-}