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();
|
super.stop();
|
||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
@Override
|
||||||
|
public void initialize() throws Exception
|
||||||
|
{
|
||||||
|
super.initialize();
|
||||||
|
|
||||||
if (_filter==null)
|
if (_filter==null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -123,6 +135,7 @@ public class FilterHolder extends Holder<Filter>
|
||||||
_filter.init(_config);
|
_filter.init(_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
@Override
|
@Override
|
||||||
public void doStop()
|
public void doStop()
|
||||||
|
|
|
@ -82,6 +82,19 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
||||||
{
|
{
|
||||||
return _extInstance;
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -741,6 +741,7 @@ public class ServletHandler extends ScopedHandler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
h.start();
|
h.start();
|
||||||
|
h.initialize();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
||||||
_enabled = enabled;
|
_enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public void doStart()
|
public void doStart()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -319,7 +319,17 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
||||||
|
|
||||||
if (_class!=null && javax.servlet.SingleThreadModel.class.isAssignableFrom(_class))
|
if (_class!=null && javax.servlet.SingleThreadModel.class.isAssignableFrom(_class))
|
||||||
_servlet = new SingleThreadedWrapper();
|
_servlet = new SingleThreadedWrapper();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
@Override
|
||||||
|
public void initialize ()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
super.initialize();
|
||||||
|
|
||||||
if (_extInstance || _initOnStartup)
|
if (_extInstance || _initOnStartup)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -335,7 +345,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public void doStop()
|
public void doStop()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
|
@ -98,7 +98,9 @@ public abstract class AbstractDoSFilterTest
|
||||||
public void startFilters() throws Exception
|
public void startFilters() throws Exception
|
||||||
{
|
{
|
||||||
_dosFilter.start();
|
_dosFilter.start();
|
||||||
|
_dosFilter.initialize();
|
||||||
_timeoutFilter.start();
|
_timeoutFilter.start();
|
||||||
|
_timeoutFilter.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
Loading…
Reference in New Issue