<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
- <version>8.0.1.v20110908</version>
+ <version>${jetty.version}</version>
<configuration>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.BlockingChannelConnector">
<url-pattern>/static</url-pattern>
</filter-mapping>
+
+ <!-- Servlet-Definitions -->
+
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
+ </servlet>
+
+
+ <!-- Servlet-Mappings -->
+
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
</web-app>
<aspectj.version>1.6.11</aspectj.version>
<httpunit.version>1.7.1</httpunit.version>
<jasper.version>6.0.29</jasper.version>
+ <jetty.version>8.1.4.v20120524</jetty.version>
<jpa.version>1.0</jpa.version>
<jstl.version>1.2</jstl.version>
<junit.version>4.8.1</junit.version>
<version>${springframework.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
<!-- hidden dependencies -->
<dependency>
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
+import org.eclipse.jetty.servlet.DefaultServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Before
public void init() throws Exception {
sr = new ServletRunner(config, ""); // Dies ist der einzige Konstruktor, der die Context-Root der Webapp im Testfall korrekt initialisiert :/
+ sr.registerServlet("default", DefaultServlet.class.getName());
client = sr.newClient();
}
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.util.Collection;
import java.util.Date;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
return locale;
}
+ @Override
+ public int getStatus() {
+ Integer status = response.getStatus();
+ log.trace("{} -- status: {}", no, status);
+ return status;
+ }
+
+ @Override
+ public String getHeader(String name) {
+ String value = response.getHeader(name);
+ log.trace("{} -- header \"{}\": {}", new Object[] { no, name, value });
+ return value;
+ }
+
+ @Override
+ public Collection<String> getHeaders(String name) {
+ Collection<String> values = response.getHeaders(name);
+ if (log.isTraceEnabled()) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(no);
+ builder.append(" -- headers \"");
+ builder.append(name);
+ builder.append("\":");
+ for (String value : values) {
+ builder.append(' ');
+ builder.append(value);
+ }
+ log.trace(builder.toString());
+ }
+ return values;
+ }
+
+ @Override
+ public Collection<String> getHeaderNames() {
+ Collection<String> values = response.getHeaderNames();
+ if (log.isTraceEnabled()) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(no);
+ builder.append(" -- header-names:");
+ for (String value : values) {
+ builder.append(' ');
+ builder.append(value);
+ }
+ log.trace(builder.toString());
+ }
+ return values;
+ }
+
class CountingServletOutputStream extends ServletOutputStream {