SWF-566 Make org.springframework.js.resource.ResourceServlet more reusable

setAllowedResourcePaths now accepts a comma separated String instead of String[].  This has better compatibility with HttpServletBean.

Added support for Ant style wildcard compressed mime types. "text/*" is now the default.  This property is configurable with setCompressedMimeType, accepting a comma separated String.
This commit is contained in:
Scott Andrews
2008-10-23 19:55:17 +00:00
parent c85cb61157
commit 52a89397d9
2 changed files with 64 additions and 12 deletions

View File

@@ -36,6 +36,7 @@ public class ResourceServletTests extends TestCase {
servlet.doGet(request, response);
assertEquals(200, response.getStatus());
assertNull(response.getHeader("Content-Encoding"));
}
public final void testExecute_CombinedResources() throws Exception {
@@ -50,6 +51,17 @@ public class ResourceServletTests extends TestCase {
assertEquals(200, response.getStatus());
}
public final void testExecute_CompressedResponse() throws Exception {
String requestPath = "/dojo/dojo.js";
request.setPathInfo(requestPath);
request.addHeader("Accept-Encoding", "gzip");
servlet.doGet(request, response);
assertEquals(200, response.getStatus());
assertEquals("gzip", response.getHeader("Content-Encoding"));
}
public final void testExecute_ResourceNotFound() throws Exception {
String requestPath = "/xxx/xxx.js";