338920 Handle non existent real path directories
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2857 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
266195cc0b
commit
a934da2d09
|
@ -1,3 +1,6 @@
|
|||
|
||||
+ 338920 Handle non existent real path directories
|
||||
|
||||
jetty-7.3.1.v20110304 4 March 2011
|
||||
+ 316382 Support a more strict SSL option with certificates
|
||||
+ 333481 Handle UCS-4 codepoints in decode and encode
|
||||
|
|
|
@ -1364,6 +1364,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
|||
{
|
||||
if (resource.exists())
|
||||
Log.warn("Aliased resource: "+resource+"~="+resource.getAlias());
|
||||
else if (path.endsWith("/") && resource.getAlias().toString().endsWith(path))
|
||||
return resource;
|
||||
else if (Log.isDebugEnabled())
|
||||
Log.debug("Aliased resource: "+resource+"~="+resource.getAlias());
|
||||
return null;
|
||||
|
|
|
@ -14,6 +14,8 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -76,4 +78,22 @@ public class WebAppContextTest
|
|||
wac.setServer(server);
|
||||
assertTrue(Arrays.equals(configs,wac.getConfigurations()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRealPathDoesNotExist() throws Exception
|
||||
{
|
||||
Server server = new Server(0);
|
||||
WebAppContext context = new WebAppContext(".", "/");
|
||||
server.setHandler(context);
|
||||
server.start();
|
||||
|
||||
// When
|
||||
ServletContext ctx = context.getServletContext();
|
||||
|
||||
// Then
|
||||
// This passes:
|
||||
assertNotNull(ctx.getRealPath("/doesnotexist"));
|
||||
// This fails:
|
||||
assertNotNull(ctx.getRealPath("/doesnotexist/"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue