You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2009/03/04 20:49:31 UTC

svn commit: r750124 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5: corelib/components/AjaxFormLoop.java internal/services/ResourceStreamer.java services/TapestryModule.java

Author: hlship
Date: Wed Mar  4 19:49:31 2009
New Revision: 750124

URL: http://svn.apache.org/viewvc?rev=750124&view=rev
Log:
TAP5-552: Common compressed image files should be configured to not re-compress when sent to client: GIF, PNG

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamer.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java?rev=750124&r1=750123&r2=750124&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.java Wed Mar  4 19:49:31 2009
@@ -32,10 +32,14 @@
 /**
  * A special form of the {@link org.apache.tapestry5.corelib.components.Loop} component that adds  Ajax support to
  * handle adding new rows and removing existing rows dynamically.  Expects that the values being iterated over are
- * entities that can be identified via a {@link org.apache.tapestry5.PrimaryKeyEncoder}.
+ * entities that can be identified via a {@link org.apache.tapestry5.ValueEncoder}.
  * <p/>
  * Works with {@link org.apache.tapestry5.corelib.components.AddRowLink} and {@link
  * org.apache.tapestry5.corelib.components.RemoveRowLink} components.
+ * <p/>
+ * The addRow event will receive the context specified by the context parameter.
+ * <p/>
+ * The removeRow event will receive the client-side value for the row being iterated.
  *
  * @see org.apache.tapestry5.EventConstants#ADD_ROW
  * @see org.apache.tapestry5.EventConstants#REMOVE_ROW

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamer.java?rev=750124&r1=750123&r2=750124&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamer.java Wed Mar  4 19:49:31 2009
@@ -23,7 +23,10 @@
  * Responsible for streaming the contents of a resource to the client. The {@link org.apache.tapestry5.ioc.Resource} to
  * stream is almost always a {@link org.apache.tapestry5.ioc.internal.util.ClasspathResource}.
  * <p/>
- * The service's configuration is used to map file extensions to content types.
+ * The service's configuration is used to map file extensions to content types. Note: this only works for simple
+ * extensions (i.e., "jpg") not for complex extensions (i.e., "tar.gz").
+ *
+ * @since 5.1.0.0
  */
 @UsesMappedConfiguration(String.class)
 public interface ResourceStreamer
@@ -39,7 +42,6 @@
      * @param resource to analyze
      * @return content type
      * @throws IOException
-     * @since 5.1.0.0
      */
     String getContentType(Resource resource) throws IOException;
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=750124&r1=750123&r2=750124&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed Mar  4 19:49:31 2009
@@ -2022,13 +2022,19 @@
 
 
     /**
-     * Adds content types for "css" and "js" file extensions. <dl> <dt>css</dt> <dd>text/css</dd> <dt>js</dt>
-     * <dd>text/javascript</dd> </dl>
+     * Adds content types: <dl> <dt>css</dt> <dd>text/css</dd> <dt>js</dt> <dd>text/javascript</dd> <dt>jpg, jpeg</dt>
+     * <dd>image/jpeg</dd> <dt>gif</dt> <dd>image/gif</dd> <dt>png</dtt> <dd>image/png</dd>
+     * <p/>
+     * </dl>
      */
     public void contributeResourceStreamer(MappedConfiguration<String, String> configuration)
     {
         configuration.add("css", "text/css");
         configuration.add("js", "text/javascript");
+        configuration.add("gif", "image/gif");
+        configuration.add("jpg", "image/jpeg");
+        configuration.add("jpeg", "image/jpeg");
+        configuration.add("png", "image/png");
     }
 
     /**
@@ -2234,13 +2240,15 @@
 
     /**
      * Contibutions are content types that do not benefit from compression. Adds the following content types: <ul>
-     * <li>image/jpeg</li> </ul>
+     * <li>image/jpeg</li> <li>image/gif <li>image/png </ul>
      *
      * @since 5.1.0.0
      */
     public static void contributeResponseCompressionAnalyzer(Configuration<String> configuration)
     {
         configuration.add("image/jpeg");
+        configuration.add("image/gif");
+        configuration.add("image/png");
     }
 
     /**