Issue #8296 - let AllowedResourceAliasChecker work before fully started
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
5f246ae5d7
commit
23df34e2d4
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue