Author: vgritsenko Date: Fri Mar 25 12:58:55 2005 New Revision: 159062 URL: http://svn.apache.org/viewcvs?view=rev&rev=159062 Log: sync with the servlet: javadocs, context-root, system properties
Modified: cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java Modified: cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java URL: http://svn.apache.org/viewcvs/cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java?view=diff&r1=159061&r2=159062 ============================================================================== --- cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java (original) +++ cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java Fri Mar 25 12:58:55 2005 @@ -277,15 +277,18 @@ } } - String value; - - // 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"); - if (value != null && value.startsWith("weblogic")) { - System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); - System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); + try { + // 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. + String value = System.getProperty("javax.xml.parsers.SAXParserFactory"); + if (value != null && value.startsWith("weblogic")) { + System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); + System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); + } + } catch (SecurityException e) { + // Ignore security exception + System.out.println("CocoonPortlet: Could not check system properties, got: " + e); } this.portletContext = conf.getPortletContext(); @@ -323,13 +326,10 @@ this.workDir.mkdirs(); this.appContext.put(Constants.CONTEXT_WORK_DIR, workDir); - // Init logger - initLogger(); - String path = this.portletContextPath; - if (getLogger().isDebugEnabled()) { - getLogger().debug("getRealPath for /: " + path); - } + // these two variables are just for debugging. We can't log at this point + // as the logger isn't initialized yet. + String debugPathOne = null, debugPathTwo = null; if (path == null) { // Try to figure out the path of the root from that of WEB-INF try { @@ -337,13 +337,9 @@ } catch (MalformedURLException me) { throw new PortletException("Unable to get resource 'WEB-INF'.", me); } - if (getLogger().isDebugEnabled()) { - getLogger().debug("getResource for /WEB-INF: " + path); - } + debugPathOne = path; path = path.substring(0, path.length() - "WEB-INF".length()); - if (getLogger().isDebugEnabled()) { - getLogger().debug("Path for Root: " + path); - } + debugPathTwo = path; } try { @@ -362,6 +358,22 @@ throw new PortletException("Unable to determine portlet context URL.", me); } } + try { + this.appContext.put("context-root", new URL(this.portletContextURL)); + } catch (MalformedURLException ignore) { + // we simply ignore this + } + + // Init logger + initLogger(); + + if (getLogger().isDebugEnabled()) { + getLogger().debug("getRealPath for /: " + this.portletContextPath); + if (this.portletContextPath == null) { + getLogger().debug("getResource for /WEB-INF: " + debugPathOne); + getLogger().debug("Path for Root: " + debugPathTwo); + } + } this.forceLoadParameter = getInitParameter("load-class", null); this.forceSystemProperty = getInitParameter("force-property", null); @@ -466,7 +478,7 @@ // get allow reload parameter, default is true this.allowReload = getInitParameterAsBoolean("allow-reload", ALLOW_RELOAD); - value = conf.getInitParameter("show-time"); + String value = conf.getInitParameter("show-time"); this.showTime = BooleanUtils.toBoolean(value) || (this.hiddenShowTime = "hide".equals(value)); if (value == null) { if (getLogger().isDebugEnabled()) { @@ -957,15 +969,16 @@ } /** - * Handle the "force-load" parameter. This overcomes limits in - * many classpath issues. One of the more notorious ones is a - * bug in WebSphere that does not load the URL handler for the - * "classloader://" protocol. In order to overcome that bug, - * set "force-load" to "com.ibm.servlet.classloader.Handler". + * Handle the <code>load-class</code> parameter. This overcomes + * limits in many classpath issues. One of the more notorious + * ones is a bug in WebSphere that does not load the URL handler + * for the <code>classloader://</code> protocol. In order to + * overcome that bug, set <code>load-class</code> parameter to + * the <code>com.ibm.servlet.classloader.Handler</code> value. * - * If you need to force more than one class to load, then - * separate each entry with whitespace, a comma, or a semi-colon. - * Cocoon will strip any whitespace from the entry. + * <p>If you need to load more than one class, then separate each + * entry with whitespace, a comma, or a semi-colon. Cocoon will + * strip any whitespace from the entry.</p> */ private void forceLoad() { if (this.forceLoadParameter != null) {