402982 Premature initialization of Servlets
This commit is contained in:
parent
c5ace89ffd
commit
cd47727ce4
|
@ -97,7 +97,19 @@ public class FilterHolder extends Holder<Filter>
|
|||
super.stop();
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void initialize() throws Exception
|
||||
{
|
||||
super.initialize();
|
||||
|
||||
if (_filter==null)
|
||||
{
|
||||
try
|
||||
|
@ -123,6 +135,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
_filter.init(_config);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void doStop()
|
||||
|
|
|
@ -82,6 +82,19 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
{
|
||||
return _extInstance;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Do any setup necessary after starting
|
||||
* @throws Exception
|
||||
*/
|
||||
public void initialize()
|
||||
throws Exception
|
||||
{
|
||||
if (!isStarted())
|
||||
throw new IllegalStateException("Not started: "+this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -741,6 +741,7 @@ public class ServletHandler extends ScopedHandler
|
|||
try
|
||||
{
|
||||
h.start();
|
||||
h.initialize();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -280,7 +280,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
_enabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void doStart()
|
||||
throws Exception
|
||||
|
@ -319,7 +319,17 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
|
||||
if (_class!=null && javax.servlet.SingleThreadModel.class.isAssignableFrom(_class))
|
||||
_servlet = new SingleThreadedWrapper();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void initialize ()
|
||||
throws Exception
|
||||
{
|
||||
super.initialize();
|
||||
|
||||
if (_extInstance || _initOnStartup)
|
||||
{
|
||||
try
|
||||
|
@ -335,7 +345,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void doStop()
|
||||
throws Exception
|
||||
|
|
|
@ -98,7 +98,9 @@ public abstract class AbstractDoSFilterTest
|
|||
public void startFilters() throws Exception
|
||||
{
|
||||
_dosFilter.start();
|
||||
_dosFilter.initialize();
|
||||
_timeoutFilter.start();
|
||||
_timeoutFilter.initialize();
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in New Issue