Have to set the application context in velocityWillInit() (which I added)
so that it's around before Velocity.init() gets called, which happens in super.init(). git-svn-id: https://samskivert.googlecode.com/svn/trunk@416 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: DispatcherServlet.java,v 1.6 2001/11/02 02:03:23 mdb Exp $
|
// $Id: DispatcherServlet.java,v 1.7 2001/11/02 02:30:54 mdb Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -169,10 +169,6 @@ public class DispatcherServlet extends VelocityServlet
|
|||||||
|
|
||||||
// Log.info("Initializing dispatcher servlet.");
|
// Log.info("Initializing dispatcher servlet.");
|
||||||
|
|
||||||
// initialize the Velocity application context
|
|
||||||
ServletContext sctx = getServletContext();
|
|
||||||
Velocity.setApplicationContext(sctx);
|
|
||||||
|
|
||||||
// load up our application configuration
|
// load up our application configuration
|
||||||
try {
|
try {
|
||||||
String appcl = config.getInitParameter(APP_CLASS_PROPS_KEY);
|
String appcl = config.getInitParameter(APP_CLASS_PROPS_KEY);
|
||||||
@@ -188,8 +184,8 @@ public class DispatcherServlet extends VelocityServlet
|
|||||||
if (StringUtil.blank(logicPkg)) {
|
if (StringUtil.blank(logicPkg)) {
|
||||||
logicPkg = "";
|
logicPkg = "";
|
||||||
}
|
}
|
||||||
_app.init(sctx);
|
_app.init(getServletContext());
|
||||||
_app.postInit(sctx, logicPkg);
|
_app.postInit(getServletContext(), logicPkg);
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("Error instantiating application.");
|
Log.warning("Error instantiating application.");
|
||||||
@@ -197,6 +193,13 @@ public class DispatcherServlet extends VelocityServlet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
protected void velocityWillInit (Properties props)
|
||||||
|
{
|
||||||
|
// stick the servlet context into the Velocity application context
|
||||||
|
Velocity.setApplicationContext(getServletContext());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up after ourselves and our application.
|
* Clean up after ourselves and our application.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user