cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r159060 - cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
Date Fri, 25 Mar 2005 20:50:08 GMT
Author: vgritsenko
Date: Fri Mar 25 12:50:05 2005
New Revision: 159060

URL: http://svn.apache.org/viewcvs?view=rev&rev=159060
Log:
sync with changes to the servlet:
javadoc, context-root entry, setting system properties

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java?view=diff&r1=159059&r2=159060
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
Fri Mar 25 12:50:05 2005
@@ -289,15 +289,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();
@@ -333,13 +336,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 {
@@ -347,13 +347,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 {
@@ -372,6 +368,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);
@@ -471,7 +483,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()) {



Mime
View raw message