274251 DefaultServlet exact welcome servlets

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@919 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-09-16 07:48:09 +00:00
parent ef917ddd20
commit f86b4124cc
3 changed files with 49 additions and 4 deletions

View File

@ -1,10 +1,11 @@
jetty-7.0.1-SNAPSHOT
+ Promoted Jetty WebApp Verifier from Sandbox
+ Promoted Jetty Centralized Logging from Sandbox
+ 274251 DefaultServlet supports exact match mode.
+ 288401 HttpExchange.cancel() Method Unimplemented
+ 289265 Test harness for async input
+ 289027 deobfuscate HttpClient SSL passwords
jetty-7.0.0.RC6-SNAPSHOT
+ JETTY-719 Document state machine of jetty http client
+ JETTY-780 CNFE during startup of webapp with spring-context >= 2.5.1

View File

@ -608,9 +608,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
if ((_welcomeServlets || _welcomeExactServlets) && welcome_servlet==null)
{
Map.Entry entry=_servletHandler.getHolderEntry(welcome_in_context);
if (entry!=null &&
((_welcomeServlets && entry.getValue()!=_defaultHolder) ||
(_welcomeExactServlets && entry.getKey().equals(pathInContext))))
if (entry!=null && entry.getValue()!=_defaultHolder &&
(_welcomeServlets || (_welcomeExactServlets && entry.getKey().equals(welcome_in_context))))
welcome_servlet=welcome_in_context;
}

View File

@ -372,6 +372,51 @@ public class DefaultServletTest extends TestCase
assertResponseContains("JSP support not configured",response);
}
public void testWelcomeExactServlet() throws Exception
{
File testDir = new File("target/tests/" + getName());
prepareEmptyTestDir(testDir);
File resBase = new File(testDir, "docroot");
resBase.mkdirs();
File inde = new File(resBase, "index.htm");
File index = new File(resBase, "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");
String response;
response= connector.getResponses("GET /context/ HTTP/1.0\r\n\r\n");
assertResponseContains("JSP support not configured",response);
createFile(index, "<h1>Hello Index</h1>");
response= connector.getResponses("GET /context/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Index</h1>",response);
createFile(inde, "<h1>Hello Inde</h1>");
response= connector.getResponses("GET /context/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Index</h1>",response);
index.delete();
response= connector.getResponses("GET /context/ HTTP/1.0\r\n\r\n");
assertResponseContains("<h1>Hello Inde</h1>",response);
inde.delete();
response= connector.getResponses("GET /context/ HTTP/1.0\r\n\r\n");
assertResponseContains("JSP support not configured",response);
}
private void createFile(File file, String str) throws IOException
{