Merge remote-tracking branch 'origin/jetty-9.4.x' into issue-1640

This commit is contained in:
Jan Bartel 2017-08-16 11:44:18 +10:00
commit c347d4859e
7 changed files with 364 additions and 243 deletions

View File

@ -1,18 +1,5 @@
jetty-9.4.7-SNAPSHOT
jetty-9.2.22.v20170606 - 06 June 2017
+ 920 no main manifest attribute, in jetty-runner-9.2.19.v20160908.jar
+ 1108 Please improve logging in SslContextFactory when there are no approved
cipher suites
+ 1357 RolloverFileOutputStream: No rollout performed at midnight
+ 1469 IllegalStateException in RolloverFileOutputStream
+ 1507 Negative delay Timer.schedule exception due to mismatched local and
_logTimeZone values
+ 1532 RolloverFileOutputStream can't handle multiple instances
+ 1523 Update ALPN support for Java 8u131
+ 1556 A timing channel in Password.java
+ 1590 RolloverFileOutputStream not functioning in Jetty 9.2.21+
jetty-9.4.6.v20170531 - 31 May 2017
+ 523 TLS close behaviour breaking session resumption
+ 1108 Please improve logging in SslContextFactory when there are no approved
@ -41,6 +28,19 @@ jetty-9.4.6.v20170531 - 31 May 2017
+ 1569 Allow setting of maxBinaryMessageSize to 0 in WebSocketPolicy
+ 1579 NPE in Quoted Quality CSV
jetty-9.2.22.v20170606 - 06 June 2017
+ 920 no main manifest attribute, in jetty-runner-9.2.19.v20160908.jar
+ 1108 Please improve logging in SslContextFactory when there are no approved
cipher suites
+ 1357 RolloverFileOutputStream: No rollout performed at midnight
+ 1469 IllegalStateException in RolloverFileOutputStream
+ 1507 Negative delay Timer.schedule exception due to mismatched local and
_logTimeZone values
+ 1532 RolloverFileOutputStream can't handle multiple instances
+ 1523 Update ALPN support for Java 8u131
+ 1556 A timing channel in Password.java
+ 1590 RolloverFileOutputStream not functioning in Jetty 9.2.21+
jetty-9.3.20.v20170531 - 31 May 2017
+ 523 TLS close behaviour breaking session resumption
+ 1108 Please improve logging in SslContextFactory when there are no approved

View File

@ -60,7 +60,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<version>2.5.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
@ -80,7 +80,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
@ -400,6 +400,56 @@
</dependencies>
</dependencyManagement>
<developers>
<developer>
<id>gregw</id>
<name>Greg Wilkins</name>
<email>gregw@webtide.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>10</timezone>
</developer>
<developer>
<id>janb</id>
<name>Jan Bartel</name>
<email>janb@webtide.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>10</timezone>
</developer>
<developer>
<id>jesse</id>
<name>Jesse McConnell</name>
<email>jesse.mcconnell@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>-6</timezone>
</developer>
<developer>
<id>joakime</id>
<name>Joakim Erdfelt</name>
<email>joakim.erdfelt@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>-7</timezone>
</developer>
<developer>
<id>sbordet</id>
<name>Simone Bordet</name>
<email>simone.bordet@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>1</timezone>
</developer>
<developer>
<id>djencks</id>
<name>David Jencks</name>
<email>david.a.jencks@gmail.com</email>
<organization>IBM</organization>
<timezone>-8</timezone>
</developer>
</developers>
<profiles>
<profile>
<id>eclipse-release</id>

View File

@ -139,16 +139,7 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet
protected DeferredContentProvider newProxyContentProvider(final HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest) throws IOException
{
return new DeferredContentProvider()
{
@Override
public boolean offer(ByteBuffer buffer, Callback callback)
{
if (_log.isDebugEnabled())
_log.debug("{} proxying content to upstream: {} bytes", getRequestId(clientRequest), buffer.remaining());
return super.offer(buffer, callback);
}
};
return new ProxyDeferredContentProvider(clientRequest);
}
protected ReadListener newProxyReadListener(HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest, DeferredContentProvider provider)
@ -823,4 +814,22 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet
return ByteBuffer.wrap(gzipBytes);
}
}
private class ProxyDeferredContentProvider extends DeferredContentProvider
{
private final HttpServletRequest clientRequest;
public ProxyDeferredContentProvider(HttpServletRequest clientRequest)
{
this.clientRequest = clientRequest;
}
@Override
public boolean offer(ByteBuffer buffer, Callback callback)
{
if (_log.isDebugEnabled())
_log.debug("{} proxying content to upstream: {} bytes", getRequestId(clientRequest), buffer.remaining());
return super.offer(buffer, callback);
}
}
}

View File

@ -240,7 +240,6 @@ public class HttpChannelState
return Action.READ_CALLBACK;
case REGISTER:
case PRODUCING:
throw new IllegalStateException(toStringLocked());
case IDLE:
case REGISTERED:
break;
@ -268,7 +267,7 @@ public class HttpChannelState
_async=Async.NOT_ASYNC;
return Action.ERROR_DISPATCH;
case STARTED:
case EXPIRING:
case EXPIRING:
case ERRORING:
return Action.WAIT;
case NOT_ASYNC:

View File

@ -393,24 +393,16 @@ public class ResourceService
// look for a welcome file
String welcome=_welcomeFactory==null?null:_welcomeFactory.getWelcomeFile(pathInContext);
if (welcome!=null)
{
if (_pathInfoOnly)
welcome = URIUtil.addPaths(request.getServletPath(),welcome);
if (LOG.isDebugEnabled())
LOG.debug("welcome={}",welcome);
RequestDispatcher dispatcher=_redirectWelcome?null:request.getRequestDispatcher(welcome);
if (dispatcher!=null)
{
// Forward to the index
if (included)
dispatcher.include(request,response);
else
{
request.setAttribute("org.eclipse.jetty.server.welcome",welcome);
dispatcher.forward(request,response);
}
}
else
if (_redirectWelcome)
{
// Redirect to the index
response.setContentLength(0);
@ -421,6 +413,20 @@ public class ResourceService
uri+="?"+q;
response.sendRedirect(response.encodeRedirectURL(uri));
return;
}
RequestDispatcher dispatcher=request.getServletContext().getRequestDispatcher(welcome);
if (dispatcher!=null)
{
// Forward to the index
if (included)
dispatcher.include(request,response);
else
{
request.setAttribute("org.eclipse.jetty.server.welcome",welcome);
dispatcher.forward(request,response);
}
}
return;
}

View File

@ -64,6 +64,8 @@ public class DefaultServletTest
@Rule
public TestingDir testdir = new TestingDir();
public File docRoot;
private Server server;
private LocalConnector connector;
private ServletContextHandler context;
@ -71,12 +73,16 @@ public class DefaultServletTest
@Before
public void init() throws Exception
{
testdir.ensureEmpty();
docRoot = testdir.getPathFile("docroot").toAbsolutePath().toFile();
server = new Server();
connector = new LocalConnector(server);
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
context = new ServletContextHandler();
context.setBaseResource(Resource.newResource(docRoot));
context.setContextPath("/context");
context.setWelcomeFiles(new String[]{"index.html", "index.jsp", "index.htm"});
@ -101,23 +107,17 @@ public class DefaultServletTest
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("gzip", "false");
testdir.ensureEmpty();
/* create some content in the docroot */
File resBase = testdir.getPathFile("docroot").toFile();
assertTrue(resBase.mkdirs());
assertTrue(new File(resBase, "one").mkdir());
assertTrue(new File(resBase, "two").mkdir());
assertTrue(new File(resBase, "three").mkdir());
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter("resourceBase", resBasePath);
assertTrue(docRoot.mkdirs());
assertTrue(new File(docRoot, "one").mkdir());
assertTrue(new File(docRoot, "two").mkdir());
assertTrue(new File(docRoot, "three").mkdir());
StringBuffer req1 = new StringBuffer();
req1.append("GET /context/;JSESSIONID=1234567890 HTTP/1.0\n\n");
String response = connector.getResponse(req1.toString());
assertResponseContains("/one/;JSESSIONID=1234567890", response);
assertResponseContains("/two/;JSESSIONID=1234567890", response);
assertResponseContains("/three/;JSESSIONID=1234567890", response);
@ -133,22 +133,16 @@ public class DefaultServletTest
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("gzip", "false");
testdir.ensureEmpty();
/* create some content in the docroot */
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
assertTrue(new File(resBase, "one").mkdir());
assertTrue(new File(resBase, "two").mkdir());
assertTrue(new File(resBase, "three").mkdir());
FS.ensureDirExists(docRoot);
assertTrue(new File(docRoot, "one").mkdir());
assertTrue(new File(docRoot, "two").mkdir());
assertTrue(new File(docRoot, "three").mkdir());
if (!OS.IS_WINDOWS)
{
assertTrue("Creating dir 'f??r' (Might not work in Windows)", new File(resBase, "f??r").mkdir());
assertTrue("Creating dir 'f??r' (Might not work in Windows)", new File(docRoot, "f??r").mkdir());
}
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter("resourceBase", resBasePath);
StringBuffer req1 = new StringBuffer();
/*
* Intentionally bad request URI. Sending a non-encoded URI with typically encoded characters '<', '>', and
@ -170,12 +164,10 @@ public class DefaultServletTest
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("gzip", "false");
testdir.ensureEmpty();
/* create some content in the docroot */
File resBase = testdir.getPathFile("docroot").toFile();
assertTrue(resBase.mkdirs());
File wackyDir = new File(resBase, "dir;"); // this should not be double-encoded.
assertTrue(docRoot.mkdirs());
File wackyDir = new File(docRoot, "dir;"); // this should not be double-encoded.
assertTrue(wackyDir.mkdirs());
assertTrue(new File(wackyDir, "four").mkdir());
@ -191,8 +183,6 @@ public class DefaultServletTest
* `-- six
*/
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter("resourceBase", resBasePath);
// First send request in improper, unencoded way.
String response = connector.getResponse("GET /context/dir;/ HTTP/1.0\r\n\r\n");
@ -222,19 +212,17 @@ public class DefaultServletTest
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("aliases", "true");
testdir.ensureEmpty();
/* create some content in the docroot */
File resBase = testdir.getPathFile("docroot").toFile();
assertTrue(resBase.mkdirs());
assertTrue(docRoot.mkdirs());
File index = new File(resBase, "index.html");
File index = new File(docRoot, "index.html");
createFile(index, "<h1>Hello Index</h1>");
File wackyDir = new File(resBase, "dir?");
File wackyDir = new File(docRoot, "dir?");
assumeTrue("FileSystem should support question dirs", wackyDir.mkdirs());
wackyDir = new File(resBase, "dir;");
wackyDir = new File(docRoot, "dir;");
assertTrue(wackyDir.mkdirs());
/* create some content outside of the docroot */
@ -253,8 +241,8 @@ public class DefaultServletTest
* `-- pass
*/
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter("resourceBase", resBasePath);
String response;
@ -316,22 +304,19 @@ public class DefaultServletTest
@Test
public void testWelcome() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
FS.ensureDirExists(docRoot);
File dir = new File(resBase, "dir");
File dir = new File(docRoot, "dir");
assertTrue(dir.mkdirs());
File inde = new File(dir, "index.htm");
File index = new File(dir, "index.html");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCacheSize", "1024000");
defholder.setInitParameter("maxCachedFileSize", "512000");
defholder.setInitParameter("maxCachedFiles", "100");
@ -359,25 +344,107 @@ public class DefaultServletTest
assertResponseContains("403", response);
}
@Test
public void testWelcomeMultipleBasesBase() throws Exception
{
FS.ensureDirExists(docRoot);
File dir = new File(docRoot, "dir");
assertTrue(dir.mkdirs());
File inde = new File(dir, "index.htm");
File index = new File(dir, "index.html");
File altRoot = testdir.getPathFile("altroot").toAbsolutePath().toFile();
File altDir = new File(altRoot, "dir");
assertTrue(altDir.mkdirs());
File altInde = new File(altDir, "index.htm");
File altIndex = new File(altDir, "index.html");
ServletHolder altholder = context.addServlet(DefaultServlet.class, "/alt/*");
altholder.setInitParameter("resourceBase",altRoot.toPath().toUri().toASCIIString());
altholder.setInitParameter("pathInfoOnly", "true");
altholder.setInitParameter("dirAllowed", "false");
altholder.setInitParameter("redirectWelcome", "false");
altholder.setInitParameter("welcomeServlets", "false");
altholder.setInitParameter("gzip", "false");
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "false");
@SuppressWarnings("unused")
ServletHolder jspholder = context.addServlet(NoJspServlet.class, "*.jsp");
String response;
// Test alt default
response = connector.getResponse("GET /context/alt/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("403", response);
createFile(altIndex, "<h1>Alt Index</h1>");
response = connector.getResponse("GET /context/alt/dir/index.html HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Alt Index</h1>", response);
response = connector.getResponse("GET /context/alt/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Alt Index</h1>", response);
createFile(altInde, "<h1>Alt Inde</h1>");
response = connector.getResponse("GET /context/alt/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Alt Index</h1>", response);
assertTrue(altIndex.delete());
response = connector.getResponse("GET /context/alt/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Alt Inde</h1>", response);
assertTrue(altInde.delete());
response = connector.getResponse("GET /context/alt/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("403", response);
// Test normal default
response = connector.getResponse("GET /context/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("403", response);
createFile(index, "<h1>Hello Index</h1>");
response = connector.getResponse("GET /context/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Index</h1>", response);
createFile(inde, "<h1>Hello Inde</h1>");
response = connector.getResponse("GET /context/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Index</h1>", response);
assertTrue(index.delete());
response = connector.getResponse("GET /context/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Inde</h1>", response);
assertTrue(inde.delete());
response = connector.getResponse("GET /context/dir/ HTTP/1.0\r\n\r\n");
assertResponseContains("403", response);
}
@Test
public void testWelcomeRedirect() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
FS.ensureDirExists(docRoot);
File dir = new File(resBase, "dir");
File dir = new File(docRoot, "dir");
assertTrue(dir.mkdirs());
File inde = new File(dir, "index.htm");
File index = new File(dir, "index.html");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "true");
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCacheSize", "1024000");
defholder.setInitParameter("maxCachedFileSize", "512000");
defholder.setInitParameter("maxCachedFiles", "100");
@ -408,12 +475,12 @@ public class DefaultServletTest
@Test
public void testWelcomeDirWithQuestion() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
context.setBaseResource(Resource.newResource(resBase));
FS.ensureDirExists(docRoot);
context.setBaseResource(Resource.newResource(docRoot));
File dir = new File(resBase, "dir?");
File dir = new File(docRoot, "dir?");
assumeTrue("FileSystem should support question dirs", dir.mkdirs());
File index = new File(dir, "index.html");
@ -435,20 +502,20 @@ public class DefaultServletTest
@Test
public void testWelcomeServlet() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File inde = new File(resBase, "index.htm");
File index = new File(resBase, "index.html");
FS.ensureDirExists(docRoot);
File inde = new File(docRoot, "index.htm");
File index = new File(docRoot, "index.html");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("welcomeServlets", "true");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("resourceBase", resBasePath);
@SuppressWarnings("unused")
ServletHolder jspholder = context.addServlet(NoJspServlet.class, "*.jsp");
@ -483,22 +550,22 @@ public class DefaultServletTest
@Test
public void testSymLinks() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File dir = new File(resBase,"dir");
File dirLink = new File(resBase,"dirlink");
File dirRLink = new File(resBase,"dirrlink");
FS.ensureDirExists(docRoot);
File dir = new File(docRoot,"dir");
File dirLink = new File(docRoot,"dirlink");
File dirRLink = new File(docRoot,"dirrlink");
FS.ensureDirExists(dir);
File foobar = new File(dir, "foobar.txt");
File link = new File(dir, "link.txt");
File rLink = new File(dir,"rlink.txt");
createFile(foobar, "Foo Bar");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("gzip", "false");
String response;
@ -547,20 +614,20 @@ public class DefaultServletTest
@Test
public void testWelcomeExactServlet() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File inde = new File(resBase, "index.htm");
File index = new File(resBase, "index.html");
FS.ensureDirExists(docRoot);
File inde = new File(docRoot, "index.htm");
File index = new File(docRoot, "index.html");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("welcomeServlets", "exact");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("resourceBase", resBasePath);
ServletHolder jspholder = context.addServlet(NoJspServlet.class, "*.jsp");
context.addServlet(jspholder, "/index.jsp");
@ -598,12 +665,12 @@ public class DefaultServletTest
if (!OS.IS_LINUX)
return;
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
context.setBaseResource(Resource.newResource(resBase));
File index = new File(resBase, "index.html");
FS.ensureDirExists(docRoot);
context.setBaseResource(Resource.newResource(docRoot));
File index = new File(docRoot, "index.html");
createFile(index, "<h1>Hello World</h1>");
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
@ -634,12 +701,12 @@ public class DefaultServletTest
@Test
public void testRangeRequests() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File data = new File(resBase, "data.txt");
FS.ensureDirExists(docRoot);
File data = new File(docRoot, "data.txt");
createFile(data, "01234567890123456789012345678901234567890123456789012345678901234567890123456789");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
@ -647,7 +714,7 @@ public class DefaultServletTest
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("acceptRanges", "true");
defholder.setInitParameter("resourceBase", resBasePath);
String response = connector.getResponse("GET /context/data.txt HTTP/1.1\r\n" +
"Host: localhost\r\n" +
@ -722,7 +789,7 @@ public class DefaultServletTest
//test a range request with a file with no suffix, therefore no mimetype
File nofilesuffix = new File(resBase, "nofilesuffix");
File nofilesuffix = new File(docRoot, "nofilesuffix");
createFile(nofilesuffix, "01234567890123456789012345678901234567890123456789012345678901234567890123456789");
response = connector.getResponse("GET /context/nofilesuffix HTTP/1.1\r\n" +
@ -779,22 +846,22 @@ public class DefaultServletTest
@Test
public void testFiltered() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File image = new File(resBase, "image.jpg");
File image = new File(docRoot, "image.jpg");
createFile(image, "not an image");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
defholder.setInitParameter("redirectWelcome", "false");
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "false");
defholder.setInitParameter("resourceBase", resBasePath);
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\n\r\n");
assertResponseContains("Content-Length: 12", response);
@ -834,15 +901,15 @@ public class DefaultServletTest
@Test
public void testGzip() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0gz = new File(resBase, "data0.txt.gz");
File file0gz = new File(docRoot, "data0.txt.gz");
createFile(file0gz, "fake gzip");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
@ -850,7 +917,7 @@ public class DefaultServletTest
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "true");
defholder.setInitParameter("etags", "true");
defholder.setInitParameter("resourceBase", resBasePath);
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\n\r\n");
assertResponseContains("Content-Length: 12", response);
@ -914,15 +981,15 @@ public class DefaultServletTest
@Test
public void testCachedGzip() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0gz = new File(resBase, "data0.txt.gz");
File file0gz = new File(docRoot, "data0.txt.gz");
createFile(file0gz, "fake gzip");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
@ -930,7 +997,7 @@ public class DefaultServletTest
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("gzip", "true");
defholder.setInitParameter("etags", "true");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCachedFiles", "1024");
defholder.setInitParameter("maxCachedFileSize", "200000000");
defholder.setInitParameter("maxCacheSize", "256000000");
@ -958,7 +1025,6 @@ public class DefaultServletTest
assertResponseContains("Content-Length: 9", response);
assertResponseContains("fake gzip",response);
assertResponseContains("Content-Type: application/gzip",response);
System.err.println(response);
assertResponseNotContains("Vary: Accept-Encoding",response);
assertResponseNotContains("Content-Encoding: gzip",response);
assertResponseNotContains("ETag: "+etag_gzip,response);
@ -984,15 +1050,15 @@ public class DefaultServletTest
@Test
public void testBrotli() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0br = new File(resBase, "data0.txt.br");
File file0br = new File(docRoot, "data0.txt.br");
createFile(file0br, "fake brotli");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
@ -1000,7 +1066,7 @@ public class DefaultServletTest
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("precompressed", "true");
defholder.setInitParameter("etags", "true");
defholder.setInitParameter("resourceBase", resBasePath);
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\n\r\n");
assertResponseContains("Content-Length: 12", response);
@ -1059,15 +1125,15 @@ public class DefaultServletTest
@Test
public void testCachedBrotli() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0br = new File(resBase, "data0.txt.br");
File file0br = new File(docRoot, "data0.txt.br");
createFile(file0br, "fake brotli");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("dirAllowed", "false");
@ -1075,7 +1141,7 @@ public class DefaultServletTest
defholder.setInitParameter("welcomeServlets", "false");
defholder.setInitParameter("precompressed", "true");
defholder.setInitParameter("etags", "true");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCachedFiles", "1024");
defholder.setInitParameter("maxCachedFileSize", "200000000");
defholder.setInitParameter("maxCacheSize", "256000000");
@ -1128,19 +1194,19 @@ public class DefaultServletTest
@Test
public void testDefaultBrotliOverGzip() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0br = new File(resBase, "data0.txt.br");
File file0br = new File(docRoot, "data0.txt.br");
createFile(file0br, "fake brotli");
File file0gz = new File(resBase, "data0.txt.gz");
File file0gz = new File(docRoot, "data0.txt.gz");
createFile(file0gz, "fake gzip");
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("precompressed", "true");
defholder.setInitParameter("resourceBase", resBase.getAbsolutePath());
defholder.setInitParameter("resourceBase", docRoot.getAbsolutePath());
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip, compress, br\r\n\r\n");
assertResponseContains("Content-Length: 11", response);
@ -1160,19 +1226,19 @@ public class DefaultServletTest
@Test
public void testCustomCompressionFormats() throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file0 = new File(resBase, "data0.txt");
FS.ensureDirExists(docRoot);
File file0 = new File(docRoot, "data0.txt");
createFile(file0, "Hello Text 0");
File file0br = new File(resBase, "data0.txt.br");
File file0br = new File(docRoot, "data0.txt.br");
createFile(file0br, "fake brotli");
File file0gz = new File(resBase, "data0.txt.gz");
File file0gz = new File(docRoot, "data0.txt.gz");
createFile(file0gz, "fake gzip");
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("precompressed", "bzip2=.bz2,gzip=.gz,br=.br");
defholder.setInitParameter("resourceBase", resBase.getAbsolutePath());
defholder.setInitParameter("resourceBase", docRoot.getAbsolutePath());
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:bzip2, br, gzip\r\n\r\n");
assertResponseContains("Content-Length: 9", response);
@ -1196,15 +1262,15 @@ public class DefaultServletTest
public void testIfModified(String content) throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file = new File(resBase, "file.txt");
FS.ensureDirExists(docRoot);
File file = new File(docRoot, "file.txt");
String resBasePath = resBase.getAbsolutePath();
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCacheSize", "4096");
defholder.setInitParameter("maxCachedFileSize", "25");
defholder.setInitParameter("maxCachedFiles", "100");
@ -1249,15 +1315,11 @@ public class DefaultServletTest
public void testIfETag(String content) throws Exception
{
testdir.ensureEmpty();
File resBase = testdir.getPathFile("docroot").toFile();
FS.ensureDirExists(resBase);
File file = new File(resBase, "file.txt");
String resBasePath = resBase.getAbsolutePath();
FS.ensureDirExists(docRoot);
File file = new File(docRoot, "file.txt");
ServletHolder defholder = context.addServlet(DefaultServlet.class, "/");
defholder.setInitParameter("resourceBase", resBasePath);
defholder.setInitParameter("maxCacheSize", "4096");
defholder.setInitParameter("maxCachedFileSize", "25");
defholder.setInitParameter("maxCachedFiles", "100");

95
pom.xml
View File

@ -384,7 +384,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>3.6.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -393,7 +393,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -411,12 +411,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<version>2.20</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -436,7 +436,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.0.0-M1</version>
<configuration>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
@ -445,8 +445,6 @@
<detectLinks>false</detectLinks>
<detectJavaApiLink>false</detectJavaApiLink>
<show>protected</show>
<!-- needed for Java 8+ -->
<additionalparam>&#45;&#45;allow-script-in-comments</additionalparam>
<excludePackageNames>com.acme.*;org.slf4j.*;org.mortbay.*</excludePackageNames>
<links>
<link>http://docs.oracle.com/javase/8/docs/api/</link>
@ -510,20 +508,6 @@
<head />
</tag>
</tags>
<header>
<![CDATA[
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1149868-7']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
]]>
</header>
</configuration>
</plugin>
<plugin>
@ -539,7 +523,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.7</version>
<version>3.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -559,12 +543,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -574,7 +558,7 @@
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0</version>
<version>3.0.0</version>
</dependency>
</dependencies>
</plugin>
@ -602,7 +586,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty.toolchain</groupId>
@ -612,22 +596,22 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.8</version>
<version>0.7.9</version>
</plugin>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.14</version>
<version>2.0.17</version>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.11</version>
<version>3.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<supportedProjectTypes>
@ -650,12 +634,12 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.3</version>
<version>1.5.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -665,7 +649,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -675,7 +659,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -992,15 +976,6 @@
</dependencies>
</dependencyManagement>
<!--
Usage:
configure settings.xml for jetty.eclipse.website server entry
> mvn -Paggregate-site javadoc:aggregate jxr:jxr
then
> mvn -N site:deploy
or
> mvn -N site:sshdeploy (for ssh users w/passphrase and ssh-agent)
-->
<profiles>
<profile>
<id>jdk8</id>
@ -1147,20 +1122,40 @@
</plugins>
</build>
</profile>
<!--
Usage:
configure settings.xml for jetty.eclipse.website server entry
> mvn -Paggregate-site javadoc:aggregate
then
> mvn -N site:deploy
or
> mvn -N site:sshdeploy (for ssh users w/passphrase and ssh-agent)
-->
<profile>
<id>aggregate-site</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- needed for Java 8+ -->
<additionalparam>&#45;&#45;allow-script-in-comments</additionalparam>
<header>
<![CDATA[
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1149868-7']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
]]>
</header>
</configuration>
</plugin>
</plugins>
</build>