WIP: Versuch den StaticTest zu reparieren...
authorKai Moritz <kai@coolibri.de>
Mon, 18 Jun 2012 23:55:48 +0000 (01:55 +0200)
committerKai Moritz <kai@coolibri.de>
Thu, 2 Aug 2012 07:03:26 +0000 (09:03 +0200)
examples/static/pom.xml
examples/static/src/test/java/org/apache/catalina/servlets/DefaultServlet.java
pom.xml

index bbe5b9b..5cf0634 100644 (file)
   <packaging>war</packaging>
   <name>Juplo - Examples: Static Content</name>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>${commons-io.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
 </project>
index 73cfe59..e96c37e 100644 (file)
@@ -1,6 +1,11 @@
 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
@@ -9,4 +14,8 @@ import javax.servlet.http.HttpServlet;
  */
 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());
+  }
 }
diff --git a/pom.xml b/pom.xml
index cc305ec..8c63f41 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
 
     <!-- Verwendete Versionen -->
     <aspectj.version>1.6.11</aspectj.version>
+    <commons-io.version>1.3.2</commons-io.version>
     <httpunit.version>1.7.1</httpunit.version>
     <jasper.version>6.0.29</jasper.version>
     <jetty.version>8.1.4.v20120524</jetty.version>