cziegeler 02/04/30 07:31:00 Modified: src/java/org/apache/cocoon/servlet CocoonServlet.java Log: Applying patch for initializing application context PR: 7868 Submitted by: [EMAIL PROTECTED] (Marcus Crafter) Revision Changes Path 1.22 +16 -6 xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java Index: CocoonServlet.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- CocoonServlet.java 27 Apr 2002 18:29:26 -0000 1.21 +++ CocoonServlet.java 30 Apr 2002 14:31:00 -0000 1.22 @@ -117,7 +117,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> - * @version CVS $Id: CocoonServlet.java,v 1.21 2002/04/27 18:29:26 vgritsenko Exp $ + * @version CVS $Id: CocoonServlet.java,v 1.22 2002/04/30 14:31:00 cziegeler Exp $ */ public class CocoonServlet extends HttpServlet { @@ -207,7 +207,7 @@ String value; - // FIXME (VG): We shouldn't have to specify these. Need to override + // FIXME (VG): We shouldn't have to specify these. Need to override // jaxp implementation of weblogic before initializing logger. // This piece of code is also required in the Cocoon class. value = System.getProperty("javax.xml.parsers.SAXParserFactory"); @@ -824,7 +824,7 @@ log.error(msg, mue); throw new ServletException(msg, mue); } - + if (result == null) { String msg = "Init parameter 'configuration' doesn't name an existing resource : " + usedFileName; log.error(msg); @@ -1192,9 +1192,7 @@ Thread.currentThread().setContextClassLoader(this.classLoader); } catch (Exception e){} - this.appContext.put(Constants.CONTEXT_CLASS_LOADER, classLoader); - this.appContext.put(Constants.CONTEXT_CLASSPATH, this.getClassPath()); - + this.updateEnvironment(); this.forceLoad(); this.forceProperty(); @@ -1228,6 +1226,18 @@ this.disposeCocoon(); } } + + /** + * Method to update the environment before Cocoon instances are created. + * + * This is also useful if you wish to customize any of the 'protected' + * variables from this class before a Cocoon instance is built in a derivative + * of this class (eg. Cocoon Context). + */ + protected void updateEnvironment() throws ServletException { + this.appContext.put(Constants.CONTEXT_CLASS_LOADER, classLoader); + this.appContext.put(Constants.CONTEXT_CLASSPATH, getClassPath()); + } private String processTime(long time) throws IOException {
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]