diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FastFileServer.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FastFileServer.java index 169ae96ec0a..5f23ad4fda2 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FastFileServer.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FastFileServer.java @@ -25,7 +25,6 @@ import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.FileChannel.MapMode; import java.nio.file.StandardOpenOption; - import javax.servlet.AsyncContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -116,7 +115,8 @@ public class FastFileServer } String listing = Resource.newResource(file).getListHTML( request.getRequestURI(), - request.getPathInfo().lastIndexOf("/") > 0); + request.getPathInfo().lastIndexOf("/") > 0, + request.getQueryString()); response.setContentType("text/html; charset=utf-8"); response.getWriter().println(listing); return; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java index 362266a4486..749f51742fb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -102,7 +101,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W return null; } - + /* ------------------------------------------------------------ */ @Override public void doStart() throws Exception @@ -156,7 +155,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Get the minimum content length for async handling. - * + * * @return The minimum size in bytes of the content before asynchronous handling is used, or -1 for no async handling or 0 (default) for using * {@link HttpServletResponse#getBufferSize()} as the minimum length. */ @@ -169,7 +168,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Get minimum memory mapped file content length. - * + * * @return the minimum size in bytes of a file resource that will be served using a memory mapped buffer, or -1 (default) for no memory mapped buffers. */ @Deprecated @@ -303,7 +302,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Get the directory option. - * + * * @return true if directories are listed. */ public boolean isDirectoriesListed() @@ -319,7 +318,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W { return _resourceService.isEtags(); } - + /* ------------------------------------------------------------ */ /** * @return If set to true, then static content will be served as gzip content encoded if a matching resource is found ending with ".gz" @@ -403,7 +402,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Set the directory. - * + * * @param directory * true if directories are listed. */ @@ -461,7 +460,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Set the minimum content length for async handling. - * + * * @param minAsyncContentLength * The minimum size in bytes of the content before asynchronous handling is used, or -1 for no async handling or 0 for using * {@link HttpServletResponse#getBufferSize()} as the minimum length. @@ -474,7 +473,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,W /* ------------------------------------------------------------ */ /** * Set minimum memory mapped file content length. - * + * * @param minMemoryMappedFileSize * the minimum size in bytes of a file resource that will be served using a memory mapped buffer, or -1 for no memory mapped buffers. */ diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index 69563a9c9f8..b2c7b6cf401 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -23,7 +23,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; - import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.UnavailableException; @@ -48,8 +47,7 @@ import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceFactory; - -/** +/** * The default servlet. *
* This servlet, normally mapped to /, provides the handling for static
@@ -79,9 +77,9 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
*
* gzip If set to true, then static content will be served as
* gzip content encoded if a matching resource is
- * found ending with ".gz" (default false)
+ * found ending with ".gz" (default false)
* (deprecated: use precompressed)
- *
+ *
* precompressed If set to a comma separated list of encoding types (that may be
* listed in a requests Accept-Encoding header) to file
* extension mappings to look for and serve. For example:
@@ -131,10 +129,10 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
public class DefaultServlet extends HttpServlet implements ResourceFactory, WelcomeFactory
{
public static final String CONTEXT_INIT = "org.eclipse.jetty.servlet.Default.";
-
+
private static final Logger LOG = Log.getLogger(DefaultServlet.class);
- private static final long serialVersionUID = 4930458713846881193L;
+ private static final long serialVersionUID = 4930458713846881193L;
private final ResourceService _resourceService;
private ServletContext _servletContext;
@@ -165,7 +163,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
{
this(new ResourceService());
}
-
+
/* ------------------------------------------------------------ */
@Override
public void init()
@@ -186,7 +184,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
_resourceService.setPrecompressedFormats(parsePrecompressedFormats(getInitParameter("precompressed"), getInitBoolean("gzip", false)));
_resourceService.setPathInfoOnly(getInitBoolean("pathInfoOnly",_resourceService.isPathInfoOnly()));
_resourceService.setEtags(getInitBoolean("etags",_resourceService.isEtags()));
-
+
if ("exact".equals(getInitParameter("welcomeServlets")))
{
_welcomeExactServlets=true;
@@ -242,8 +240,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
String cc=getInitParameter("cacheControl");
if (cc!=null)
_resourceService.setCacheControl(new PreEncodedHttpField(HttpHeader.CACHE_CONTROL,cc));
-
-
+
+
String resourceCache = getInitParameter("resourceCache");
int max_cache_size=getInitInt("maxCacheSize", -2);
int max_cached_file_size=getInitInt("maxCachedFileSize", -2);
@@ -286,7 +284,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
}
_resourceService.setContentFactory(contentFactory);
_resourceService.setWelcomeFactory(this);
-
+
List