Return-Path: Delivered-To: apmail-incubator-click-commits-archive@minotaur.apache.org Received: (qmail 97577 invoked from network); 19 Jun 2009 15:34:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Jun 2009 15:34:54 -0000 Received: (qmail 13659 invoked by uid 500); 19 Jun 2009 15:35:05 -0000 Delivered-To: apmail-incubator-click-commits-archive@incubator.apache.org Received: (qmail 13646 invoked by uid 500); 19 Jun 2009 15:35:05 -0000 Mailing-List: contact click-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@incubator.apache.org Delivered-To: mailing list click-commits@incubator.apache.org Received: (qmail 13636 invoked by uid 99); 19 Jun 2009 15:35:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 15:35:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 15:35:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B2790238889B; Fri, 19 Jun 2009 15:34:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r786549 - /incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java Date: Fri, 19 Jun 2009 15:34:39 -0000 To: click-commits@incubator.apache.org From: sabob@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090619153439.B2790238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sabob Date: Fri Jun 19 15:34:39 2009 New Revision: 786549 URL: http://svn.apache.org/viewvc?rev=786549&view=rev Log: formatting Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java?rev=786549&r1=786548&r2=786549&view=diff ============================================================================== --- incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java (original) +++ incubator/click/trunk/click/extras/src/org/apache/click/extras/gae/GoogleAppEngineListener.java Fri Jun 19 15:34:39 2009 @@ -1,162 +1,162 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.click.extras.gae; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import ognl.OgnlRuntime; - -/** - * Provides Google App Engine (GAE) support for Click applications. - *

- * To deploy Click applications to GAE, you need to set the - * GoogleAppEngineListener listener in your web.xml: - * - *

- * <?xml version="1.0" encoding="utf-8"?>
- * <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
- *
- *     <listener>
- *         <listener-class>org.apache.click.extras.gae.GoogleAppEngineListener</listener-class>
- *     </listener>
- *
- *     <servlet>
- *         <servlet-name>ClickClickServlet</servlet-name>
- *         <servlet-class>net.sf.clickclick.ClickClickServlet</servlet-class>
- *         <load-on-startup>0</load-on-startup>
- *     </servlet>
- *     <servlet-mapping>
- *         <servlet-name>ClickClickServlet</servlet-name>
- *         <url-pattern>*.htm</url-pattern>
- *     </servlet-mapping>
- * </web-app> 
- * - * You also need to configure GAE to exclude *.htm files from being - * served as static resources. Also you should enable http-session - * support. You set these changes in the GAE file war/WEB-INF/appengine-web.xml: - * - *
- * <?xml version="1.0" encoding="utf-8"?>
- * <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
- *     <application>myapp</application>
- *     <version>1</version>
- *
- *	   <!-- Configure java.util.logging -->
- *     <system-properties>
- *         <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
- *     </system-properties>
- *
- *     <!-- Enable HttpSession usage -->
- *     <sessions-enabled>true</sessions-enabled>
- *
- *     <!-- Exclude *.htm files from being served as static files by GAE,
- *             because the *.htm extension is mapped to ClickServlet. -->
- *     <static-files>
- *         <exclude path="**.htm" />
- *     </static-files>
- *
- * </appengine-web-app> 
- * - *

File Uploads

- * - * GAE does not allow web application to write to files on disk. This poses a - * problem for the {@link org.apache.click.control.FileField} control that - * depends on Commons FileUpload - * which stores uploaded files on disk. To work around this limitation Click - * provides the {@link MemoryFileUploadService} which stores uploaded files in - * memory. - *

- * Below is an example configuration of a {@link MemoryFileUploadService}: - * - *

- * <click-app charset="UTF-8">
- *     <pages package="com.myapp.pages"/>
- *     <mode value="production"/>
- *
- *     <file-upload-service classname="org.apache.click.extras.gae.MemoryFileUploadService">
- *         <!-- Set the total request maximum size to 10mb (10 x 1024 x 1024 = 10485760).
- *                 The default request upload size is unlimited. -->
- *         <property name="sizeMax" value="10485760"/>
- *
- *         <!-- Set the maximum individual file size to 2mb (2 x 1024 x 1024 = 2097152).
- *             The default file upload size is unlimited. -->
- *         <property name="fileSizeMax" value="2097152"/>
- *    </file-upload-service>
- * </click-app> 
- * - *

Performance Filter

- * - * If you use Click's {@link org.apache.click.extras.filter.PerformanceFilter} - * you should also exclude the following static files from GAE, so that - * PerformanceFilter can set their expiry headers: - * *.css, *.js, *.png and *.gif. For example: - * - *
- * <?xml version="1.0" encoding="utf-8"?>
- * <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
- *
- *     ...
- *
- *     <!-- Exclude the following files from being served as static files by GAE,
- *             as they will be processed by Click's PerformanceFilter. -->
- *     <static-files>
- *         <exclude path="**.htm" />
- *         <exclude path="**.css" />
- *         <exclude path="**.js" />
- *         <exclude path="**.png" />
- *         <exclude path="**.gif" />
- *     </static-files>
- *
- * </appengine-web-app> 
- * - * @author Bob Schellink - */ -public class GoogleAppEngineListener implements ServletContextListener { - - /** - * Creates a default GoogleAppEngineListener. - */ - public GoogleAppEngineListener() { - } - - /** - * This method does nothing. - * - * @param servletContextEvent the event class for notifications about - * changes to the servlet context - */ - public void contextDestroyed(ServletContextEvent servletContextEvent) { - } - - /** - * Sets the Ognl Runtime SecurityManager to null so as not to - * interfere with Google App Engine (GAE). GAE provides its own strict - * SecurityManager which clashes with Ognl security checks. - * - *
-     * OgnlRuntime.setSecurityManager(null); 
- * - * @param servletContextEvent the event class for notifications about - * changes to the servlet context - */ - public void contextInitialized(ServletContextEvent servletContextEvent) { - OgnlRuntime.setSecurityManager(null); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.click.extras.gae; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import ognl.OgnlRuntime; + +/** + * Provides Google App Engine (GAE) support for Click applications. + *

+ * To deploy Click applications to GAE, you need to set the + * GoogleAppEngineListener listener in your web.xml: + * + *

+ * <?xml version="1.0" encoding="utf-8"?>
+ * <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
+ *
+ *     <listener>
+ *         <listener-class>org.apache.click.extras.gae.GoogleAppEngineListener</listener-class>
+ *     </listener>
+ *
+ *     <servlet>
+ *         <servlet-name>ClickClickServlet</servlet-name>
+ *         <servlet-class>net.sf.clickclick.ClickClickServlet</servlet-class>
+ *         <load-on-startup>0</load-on-startup>
+ *     </servlet>
+ *     <servlet-mapping>
+ *         <servlet-name>ClickClickServlet</servlet-name>
+ *         <url-pattern>*.htm</url-pattern>
+ *     </servlet-mapping>
+ * </web-app> 
+ * + * You also need to configure GAE to exclude *.htm files from being + * served as static resources. Also you should enable http-session + * support. You set these changes in the GAE file war/WEB-INF/appengine-web.xml: + * + *
+ * <?xml version="1.0" encoding="utf-8"?>
+ * <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
+ *     <application>myapp</application>
+ *     <version>1</version>
+ *
+ *       <!-- Configure java.util.logging -->
+ *     <system-properties>
+ *         <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
+ *     </system-properties>
+ *
+ *     <!-- Enable HttpSession usage -->
+ *     <sessions-enabled>true</sessions-enabled>
+ *
+ *     <!-- Exclude *.htm files from being served as static files by GAE,
+ *             because the *.htm extension is mapped to ClickServlet. -->
+ *     <static-files>
+ *         <exclude path="**.htm" />
+ *     </static-files>
+ *
+ * </appengine-web-app> 
+ * + *

File Uploads

+ * + * GAE does not allow web application to write to files on disk. This poses a + * problem for the {@link org.apache.click.control.FileField} control that + * depends on Commons FileUpload + * which stores uploaded files on disk. To work around this limitation Click + * provides the {@link MemoryFileUploadService} which stores uploaded files in + * memory. + *

+ * Below is an example configuration of a {@link MemoryFileUploadService}: + * + *

+ * <click-app charset="UTF-8">
+ *     <pages package="com.myapp.pages"/>
+ *     <mode value="production"/>
+ *
+ *     <file-upload-service classname="org.apache.click.extras.gae.MemoryFileUploadService">
+ *         <!-- Set the total request maximum size to 10mb (10 x 1024 x 1024 = 10485760).
+ *                 The default request upload size is unlimited. -->
+ *         <property name="sizeMax" value="10485760"/>
+ *
+ *         <!-- Set the maximum individual file size to 2mb (2 x 1024 x 1024 = 2097152).
+ *             The default file upload size is unlimited. -->
+ *         <property name="fileSizeMax" value="2097152"/>
+ *    </file-upload-service>
+ * </click-app> 
+ * + *

Performance Filter

+ * + * If you use Click's {@link org.apache.click.extras.filter.PerformanceFilter} + * you should also exclude the following static files from GAE, so that + * PerformanceFilter can set their expiry headers: + * *.css, *.js, *.png and *.gif. For example: + * + *
+ * <?xml version="1.0" encoding="utf-8"?>
+ * <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
+ *
+ *     ...
+ *
+ *     <!-- Exclude the following files from being served as static files by GAE,
+ *             as they will be processed by Click's PerformanceFilter. -->
+ *     <static-files>
+ *         <exclude path="**.htm" />
+ *         <exclude path="**.css" />
+ *         <exclude path="**.js" />
+ *         <exclude path="**.png" />
+ *         <exclude path="**.gif" />
+ *     </static-files>
+ *
+ * </appengine-web-app> 
+ * + * @author Bob Schellink + */ +public class GoogleAppEngineListener implements ServletContextListener { + + /** + * Creates a default GoogleAppEngineListener. + */ + public GoogleAppEngineListener() { + } + + /** + * This method does nothing. + * + * @param servletContextEvent the event class for notifications about + * changes to the servlet context + */ + public void contextDestroyed(ServletContextEvent servletContextEvent) { + } + + /** + * Sets the Ognl Runtime SecurityManager to null so as not to + * interfere with Google App Engine (GAE). GAE provides its own strict + * SecurityManager which clashes with Ognl security checks. + * + *
+     * OgnlRuntime.setSecurityManager(null); 
+ * + * @param servletContextEvent the event class for notifications about + * changes to the servlet context + */ + public void contextInitialized(ServletContextEvent servletContextEvent) { + OgnlRuntime.setSecurityManager(null); + } +}