407931 Add toggle for failing on servlet availability
This commit is contained in:
parent
76d4859eda
commit
9c168866ff
|
@ -104,8 +104,8 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
{
|
||||
//if no class already loaded and no classname, make servlet permanently unavailable
|
||||
if (_class==null && (_className==null || _className.equals("")))
|
||||
throw new UnavailableException("No class for Servlet or Filter for "+_name, -1);
|
||||
|
||||
throw new UnavailableException("No class for Servlet or Filter for "+_name);
|
||||
|
||||
//try to load class
|
||||
if (_class==null)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
catch (Exception e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
throw new UnavailableException(e.getMessage(), -1);
|
||||
throw new UnavailableException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ServletHandler extends ScopedHandler
|
|||
private int _matchAfterIndex = -1; //index of 1st programmatic FilterMapping with isMatchAfter=true
|
||||
private boolean _filterChainsCached=true;
|
||||
private int _maxFilterChainsCacheSize=512;
|
||||
private boolean _startWithUnavailable=true;
|
||||
private boolean _startWithUnavailable=false;
|
||||
private IdentityService _identityService;
|
||||
|
||||
private ServletHolder[] _servlets=new ServletHolder[0];
|
||||
|
|
|
@ -288,6 +288,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
_unavailable=0;
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
|
||||
//check servlet has a class (ie is not a preliminary registration). If preliminary, fail startup.
|
||||
try
|
||||
{
|
||||
|
@ -296,9 +298,17 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
catch (UnavailableException ue)
|
||||
{
|
||||
makeUnavailable(ue);
|
||||
throw ue;
|
||||
if (_servletHandler.isStartWithUnavailable())
|
||||
{
|
||||
LOG.ignore(ue);
|
||||
return;
|
||||
}
|
||||
else
|
||||
throw ue;
|
||||
}
|
||||
|
||||
|
||||
//servlet is not an instance of javax.servlet.Servlet
|
||||
try
|
||||
{
|
||||
checkServletType();
|
||||
|
@ -306,8 +316,13 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
catch (UnavailableException ue)
|
||||
{
|
||||
makeUnavailable(ue);
|
||||
if (!_servletHandler.isStartWithUnavailable())
|
||||
throw ue; //servlet is not an instance of javax.servlet.Servlet
|
||||
if (_servletHandler.isStartWithUnavailable())
|
||||
{
|
||||
LOG.ignore(ue);
|
||||
return;
|
||||
}
|
||||
else
|
||||
throw ue;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue