Merge remote-tracking branch 'origin/jetty-9.2.x'
Conflicts: jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java jetty-util/src/test/java/org/eclipse/jetty/util/resource/AbstractFSResourceTest.java
This commit is contained in:
commit
a6e00bc642
|
@ -327,8 +327,8 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
serverChannel = ServerSocketChannel.open();
|
||||
|
||||
InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort());
|
||||
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
|
||||
serverChannel.socket().setReuseAddress(getReuseAddress());
|
||||
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
|
||||
|
||||
_localPort = serverChannel.socket().getLocalPort();
|
||||
if (_localPort <= 0)
|
||||
|
|
|
@ -303,6 +303,9 @@ public class ResourceHandler extends HandlerWrapper
|
|||
if (path==null || !path.startsWith("/"))
|
||||
throw new MalformedURLException(path);
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} getResource({})",_context==null?_baseResource:_context,_baseResource,path);
|
||||
|
||||
Resource base = _baseResource;
|
||||
if (base==null)
|
||||
{
|
||||
|
@ -315,8 +318,12 @@ public class ResourceHandler extends HandlerWrapper
|
|||
{
|
||||
path=URIUtil.canonicalPath(path);
|
||||
Resource r = base.addPath(path);
|
||||
if (r!=null && r.isAlias() && !_context.checkAlias(path, r))
|
||||
if (r!=null && r.isAlias() && (_context==null || !_context.checkAlias(path, r)))
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("resource={} alias={}",r,r.getAlias());
|
||||
return null;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
catch(Exception e)
|
||||
|
@ -404,6 +411,16 @@ public class ResourceHandler extends HandlerWrapper
|
|||
}
|
||||
|
||||
Resource resource = getResource(request);
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
if (resource==null)
|
||||
LOG.debug("resource=null");
|
||||
else
|
||||
LOG.debug("resource={} alias={} exists={}",resource,resource.getAlias(),resource.exists());
|
||||
}
|
||||
|
||||
|
||||
// If resource is not found
|
||||
if (resource==null || !resource.exists())
|
||||
{
|
||||
|
|
|
@ -114,6 +114,7 @@ public class StartLog
|
|||
if (logFileName != null)
|
||||
{
|
||||
Path logfile = baseHome.getPath(logFileName);
|
||||
logfile = logfile.toAbsolutePath();
|
||||
initLogFile(logfile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -839,13 +839,12 @@ public class URIUtil
|
|||
if (cb=='%')
|
||||
cb=TypeUtil.convertHexDigit(uriB.charAt(b++))*16+TypeUtil.convertHexDigit(uriB.charAt(b++));
|
||||
|
||||
if (ca!=cb)
|
||||
return false;
|
||||
|
||||
if (ca=='/' && oa!=ob)
|
||||
return false;
|
||||
|
||||
if (ca!=cb )
|
||||
return URIUtil.decodePath(uriA).equals(URIUtil.decodePath(uriB));
|
||||
}
|
||||
|
||||
return a==lenA && b==lenB;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import org.eclipse.jetty.util.CollectionAssert;
|
|||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -1043,4 +1044,20 @@ public class FileSystemResourceTest
|
|||
assertThat("File should have been deleted.",res.exists(),is(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUtf8Dir() throws Exception
|
||||
{
|
||||
File dir=new File(testdir.getDir(),"bãm");
|
||||
dir.mkdir();
|
||||
File file = new File(dir,"file.txt");
|
||||
file.createNewFile();
|
||||
|
||||
Resource base = newResource(dir);
|
||||
assertNull(base.getAlias());
|
||||
|
||||
Resource r = base.addPath("file.txt");
|
||||
assertNull(r.getAlias());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class XmlConfiguration
|
|||
|
||||
private static final Iterable<ConfigurationProcessorFactory> __factoryLoader = ServiceLoader.load(ConfigurationProcessorFactory.class);
|
||||
private static final XmlParser __parser = initParser();
|
||||
private synchronized static XmlParser initParser()
|
||||
private static XmlParser initParser()
|
||||
{
|
||||
XmlParser parser = new XmlParser();
|
||||
URL config60 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_6_0.dtd");
|
||||
|
|
Loading…
Reference in New Issue