use of org.mortbay.jetty.plugin.JettyWebAppContext in project jangaroo-tools by CoreMedia.
the class JooTestMojoBase method jettyRunTest.
protected Server jettyRunTest(boolean tryPortRange) throws MojoExecutionException {
JettyWebAppContext handler;
try {
handler = new JettyWebAppContext();
handler.setWebInfLib(findJars());
handler.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
List<Resource> baseResources = new ArrayList<Resource>();
baseResources.add(toResource(new File(outputDirectory, "META-INF/resources")));
baseResources.add(toResource(testOutputDirectory));
for (org.apache.maven.model.Resource r : testResources) {
File testResourceDirectory = new File(r.getDirectory());
if (testResourceDirectory.exists()) {
baseResources.add(toResource(testResourceDirectory));
}
}
handler.setBaseResource(new ResourceCollection(baseResources.toArray(new Resource[baseResources.size()])));
getLog().info("Using base resources " + baseResources);
ServletHolder servletHolder = new ServletHolder("default", DefaultServlet.class);
servletHolder.setInitParameter("cacheControl", "no-store, no-cache, must-revalidate, max-age=0");
handler.addServlet(servletHolder, "/");
getLog().info("Set servlet cache control to 'do not cache'.");
} catch (Exception e) {
throw wrap(e);
}
return startJetty(handler, tryPortRange);
}
Aggregations