Issue #8296 - attempt to resolve symlinks for baseResource in ContextHandler.doStart()
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
6c35fc6f65
commit
cff4ff6c98
|
@ -859,8 +859,15 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
throw new IllegalStateException("Null contextPath");
|
||||
|
||||
if (getBaseResource() != null && getBaseResource().isAlias())
|
||||
{
|
||||
// We may have symlink to baseResource, try to resolve symlink if possible.
|
||||
File file = getBaseResource().getFile();
|
||||
if (file != null)
|
||||
_baseResource = Resource.newResource(file.toPath().toRealPath());
|
||||
|
||||
LOG.warn("BaseResource {} is aliased to {} in {}. May not be supported in future releases.",
|
||||
getBaseResource(), getBaseResource().getAlias(), this);
|
||||
}
|
||||
|
||||
_availability.set(Availability.STARTING);
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ public class AliasCheckerWebRootIsSymlinkTest
|
|||
}
|
||||
});
|
||||
_server.start();
|
||||
assertThat(_context.getBaseResource().isAlias(), equalTo(false));
|
||||
|
||||
// We can access web.xml with ServletContext.getResource().
|
||||
InputStream webXml = resource.get(5, TimeUnit.SECONDS);
|
||||
|
|
Loading…
Reference in New Issue