Issue #8296 - let AllowedResourceAliasChecker work before fully started

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2022-07-18 15:21:17 +10:00
parent 5f246ae5d7
commit 23df34e2d4
1 changed files with 10 additions and 1 deletions

View File

@ -45,6 +45,7 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
private final ContextHandler _contextHandler;
private final List<Path> _protected = new ArrayList<>();
private final AllowedResourceAliasCheckListener _listener = new AllowedResourceAliasCheckListener();
private boolean _initialized;
protected Path _base;
/**
@ -60,7 +61,7 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
return _contextHandler;
}
protected void initialize()
private void extractBaseResourceFromContext()
{
_base = getPath(_contextHandler.getBaseResource());
if (_base == null)
@ -84,6 +85,12 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
}
}
protected void initialize()
{
extractBaseResourceFromContext();
_initialized = true;
}
@Override
protected void doStart() throws Exception
{
@ -106,6 +113,8 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
@Override
public boolean check(String pathInContext, Resource resource)
{
if (!_initialized)
extractBaseResourceFromContext();
if (_base == null)
return false;