Merge remote-tracking branch 'origin/master' into jetty-9.1
This commit is contained in:
commit
1d5730d8d2
|
@ -2745,8 +2745,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
|
||||
if (a.length()>r.length())
|
||||
return a.startsWith(r) && a.length()==r.length()+1 && a.endsWith("/");
|
||||
else
|
||||
if (a.length()<r.length())
|
||||
return r.startsWith(a) && r.length()==a.length()+1 && r.endsWith("/");
|
||||
|
||||
return a.equals(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,6 @@ public class ContextHandlerGetResourceTest
|
|||
assertEquals(docroot,new File(url.toURI()).getParentFile());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTooNormal() throws Exception
|
||||
{
|
||||
|
@ -293,6 +292,23 @@ public class ContextHandlerGetResourceTest
|
|||
URL url=context.getServletContext().getResource(path);
|
||||
assertNull(url);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSlashSlash() throws Exception
|
||||
{
|
||||
String path="//subdir/data.txt";
|
||||
Resource resource=context.getResource(path);
|
||||
assertNull(resource);
|
||||
URL url=context.getServletContext().getResource(path);
|
||||
assertNull(url);
|
||||
|
||||
path="/subdir//data.txt";
|
||||
resource=context.getResource(path);
|
||||
assertNull(resource);
|
||||
url=context.getServletContext().getResource(path);
|
||||
assertNull(url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAliasedFile() throws Exception
|
||||
|
|
|
@ -109,7 +109,20 @@ public class FileResource extends Resource
|
|||
File file=new File(uri);
|
||||
_file=file;
|
||||
_uri=normalizeURI(_file,uri);
|
||||
_alias=checkAlias(_file);
|
||||
|
||||
if (!_uri.equals(_file.toURI()) && !_uri.toString().equals(_file.toURI().toString()))
|
||||
{
|
||||
try
|
||||
{
|
||||
_alias=_file.toURI().toURL();
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
_alias=checkAlias(_file);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
|
@ -394,7 +407,7 @@ public class FileResource extends Resource
|
|||
{
|
||||
try
|
||||
{
|
||||
return _file.toURI().toURL();
|
||||
return new URL(_uri);
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue