click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r958342 - /click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
Date Sun, 27 Jun 2010 07:05:45 GMT
Author: sabob
Date: Sun Jun 27 07:05:45 2010
New Revision: 958342

URL: http://svn.apache.org/viewvc?rev=958342&view=rev
Log:
revert GAE changes

Modified:
    click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java   (contents,
props changed)

Modified: click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java?rev=958342&r1=958341&r2=958342&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java (original)
+++ click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java Sun Jun
27 07:05:45 2010
@@ -141,8 +141,6 @@ public class XmlConfigService implements
         DEFAULT_HEADERS.put("Expires", new Date(1L));
     }
 
-    private static final String GOOGLE_APP_ENGINE = "Google App Engine";
-
     // ------------------------------------------------ Package Private Members
 
     /** The Map of global page headers. */
@@ -202,9 +200,6 @@ public class XmlConfigService implements
     /** The application TemplateService. */
     private MessagesMapService messagesMapService;
 
-    /** Flag indicating whether Click is running on Google App Engine. */
-    private boolean onGoogleAppEngine = false;
-
     // --------------------------------------------------------- Public Methods
 
     /**
@@ -219,8 +214,6 @@ public class XmlConfigService implements
 
         this.servletContext = servletContext;
 
-        onGoogleAppEngine = servletContext.getServerInfo().startsWith(GOOGLE_APP_ENGINE);
-
         // Set default logService early to log errors when services fail.
         logService = new ConsoleLogService();
         messagesMapService = new DefaultMessagesMapService();
@@ -1314,45 +1307,43 @@ public class XmlConfigService implements
      */
     private void deployFiles(Element rootElm) throws Exception {
 
-        // Guard agaist GAE which can report that resources are deployable even when they
are not
-        boolean isResourcesDeployable = onGoogleAppEngine ? false : isResourcesDeployable();
+        boolean isResourcesDeployable = isResourcesDeployable();
 
         if (isResourcesDeployable) {
-            if (getLogService().isTraceEnabled()) {
-                String deployTarget = servletContext.getRealPath("/");
-                getLogService().trace("resource deploy folder: "
-                    + deployTarget);
-            }
+            try {
+                if (getLogService().isTraceEnabled()) {
+                    String deployTarget = servletContext.getRealPath("/");
+                    getLogService().trace("resource deploy folder: "
+                        + deployTarget);
+                }
 
-            deployControls(getResourceRootElement("/click-controls.xml"));
-            deployControls(getResourceRootElement("/extras-controls.xml"));
-            deployControls(rootElm);
-            deployControlSets(rootElm);
-            deployResourcesOnClasspath();
+                deployControls(getResourceRootElement("/click-controls.xml"));
+                deployControls(getResourceRootElement("/extras-controls.xml"));
+                deployControls(rootElm);
+                deployControlSets(rootElm);
+                deployResourcesOnClasspath();
+
+            } catch (Error ignore) {
+                // Google App Engine (GAE) can indicate that resources are deployable
+                // when they are not, and will throw an error if restricted classes
+                // such as FileOutputStream are accessed. We will log a warning
+                // to indicate that resources could not be deployed.
+                isResourcesDeployable = false;
+            }
         }
 
         if (!isResourcesDeployable) {
-
-            HtmlStringBuffer buffer = new HtmlStringBuffer();
-            if (onGoogleAppEngine) {
-                buffer.append("Google App Engine does not support deploying");
-                buffer.append(" resources to the 'click' web folder.\n");
-
-            } else {
-                buffer.append("could not deploy Click resources to the 'click'");
-                buffer.append(" web folder.\nThis can occur if the call to");
-                buffer.append(" ServletContext.getRealPath(\"/\") returns null, which means");
-                buffer.append(" the web application cannot determine the file system path");
-                buffer.append(" to deploy files to. This issue also occurs if the web");
-                buffer.append(" application is not allowed to write to the file");
-                buffer.append(" system.\n");
-            }
-
-            buffer.append("To resolve this issue please see the Click user-guide:");
-            buffer.append(" http://click.apache.org/docs/user-guide/html/ch04s03.html#deploying-restricted-env");
-            buffer.append(" \nIgnore this warning once you have settled on a");
-            buffer.append(" deployment strategy");
-            getLogService().warn(buffer.toString());
+            String msg = "could not deploy Click resources to the"
+                + " 'click' web folder.\nThis can occur if the call to"
+                + " ServletContext.getRealPath(\"/\") returns null, which means"
+                + " the web application cannot determine the file system path"
+                + " to deploy files to. Another common problem is if the web"
+                + " application is not allowed to write to the file"
+                + " system.\nTo resolve this issue please see the Click user-guide:"
+                + " http://click.apache.org/docs/user-guide/html/ch04s03.html#deploying-restricted-env"
+                + " \nIgnore this warning in the future once you have settled on a"
+                + " deployment strategy";
+            getLogService().warn(msg);
         }
     }
 
@@ -1768,18 +1759,6 @@ public class XmlConfigService implements
         List fileList = new ArrayList();
 
         Set resources = servletContext.getResourcePaths("/");
-        if (onGoogleAppEngine) {
-            // resources could be immutable so create copy
-            Set tempResources = new HashSet();
-
-            // Load the two GAE preconfigured automapped folders
-            tempResources.addAll(servletContext.getResourcePaths("/page"));
-            tempResources.addAll(servletContext.getResourcePaths("/pages"));
-            tempResources.addAll(resources);
-
-            // assign copy to resources
-            resources = Collections.unmodifiableSet(tempResources);
-        }
 
         // Add all resources within web application
         for (Iterator i = resources.iterator(); i.hasNext();) {

Propchange: click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
            ('svn:mergeinfo' removed)



Mime
View raw message