You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/10/25 03:55:48 UTC

svn commit: r1188490 [3/3] - in /myfaces/core/branches/2.0.x_refactor_shade_duplicate: ./ api/ assembly/ bundle/ impl/ implee6/ integration-tests/ parent/ shared-utils/ shared-utils/src/main/java/org/apache/myfaces/shared/util/ shared-utils/src/main/ja...

Modified: myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java?rev=1188490&r1=1188489&r2=1188490&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java (original)
+++ myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java Tue Oct 25 01:55:46 2011
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.commons.util.renderkit;
+package org.apache.myfaces.shared.util.renderkit;
 
 /**
  * Holds the client behavior events.

Modified: myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java?rev=1188490&r1=1188489&r2=1188490&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java (original)
+++ myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java Tue Oct 25 01:55:46 2011
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.commons.util.renderkit;
+package org.apache.myfaces.shared.util.renderkit;
 
-import org.apache.myfaces.commons.util.ArrayUtils;
+import org.apache.myfaces.shared.util.ArrayUtils;
 
 
 /**

Modified: myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/JsfProperties.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/JsfProperties.java?rev=1188490&r1=1188489&r2=1188490&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/JsfProperties.java (original)
+++ myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared-utils/src/main/java/org/apache/myfaces/shared/util/renderkit/JsfProperties.java Tue Oct 25 01:55:46 2011
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.commons.util.renderkit;
+package org.apache.myfaces.shared.util.renderkit;
 
 
 /**

Modified: myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/pom.xml?rev=1188490&r1=1188489&r2=1188490&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/pom.xml (original)
+++ myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/pom.xml Tue Oct 25 01:55:46 2011
@@ -21,6 +21,7 @@
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-core-project</artifactId>
       <version>2.0.10-SNAPSHOT</version>
+      <relativePath>../parent/pom.xml</relativePath>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
@@ -44,6 +45,12 @@
             <groupId>org.apache.myfaces.core</groupId>
             <artifactId>myfaces-api</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.myfaces.core.internal</groupId>
+            <artifactId>myfaces-impl-shared-utils</artifactId>
+            <optional>true</optional> 
+        </dependency>
 
         <!-- Servlet 2.5 -->
         <dependency>
@@ -113,9 +120,43 @@
          </executions>
       </plugin>
       <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-shade-plugin</artifactId>
+          <executions>
+              <execution>
+                  <phase>package</phase>
+                  <goals>
+                      <goal>shade</goal>
+                  </goals>
+              </execution>
+          </executions>
+          <configuration>
+              <createDependencyReducedPom>false</createDependencyReducedPom>
+              <createSourcesJar>true</createSourcesJar>
+              <artifactSet>
+                  <includes>
+                      <include>org.apache.myfaces.core.internal:myfaces-impl-shared-utils</include>
+                  </includes>
+              </artifactSet>
+              <filters>
+                  <filter>
+                      <artifact>org.apache.myfaces.core.internal:myfaces-impl-shared-utils</artifact>
+                      <includes>
+                          <include>org/apache/myfaces/**</include>
+                      </includes>
+                      <excludes>
+                          <exclude>META-INF/LICENSE</exclude>
+                          <exclude>META-INF/NOTICE</exclude>
+                          <exclude>META-INF/DEPENDENCIES</exclude>
+                          <exclude>META-INF/MANIFEST.MF</exclude>
+                      </excludes>
+                  </filter>
+              </filters>
+          </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
-        <version>1.5</version>
         <executions>
           <execution>
             <id>add-resource</id>
@@ -136,7 +177,6 @@
       <plugin>
           <artifactId>myfaces-javascript-plugin</artifactId>
           <groupId>org.apache.myfaces.buildtools</groupId>
-          <version>1.0.1</version>
           <extensions>true</extensions>
           <executions>
                <execution>
@@ -195,17 +235,6 @@
         </configuration>
       </plugin>
        -->
-      <plugin>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-source</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
   <profiles>

Modified: myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java?rev=1188490&r1=1188489&r2=1188490&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java (original)
+++ myfaces/core/branches/2.0.x_refactor_shade_duplicate/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java Tue Oct 25 01:55:46 2011
@@ -37,6 +37,9 @@ import javax.faces.render.RenderKit;
 import javax.faces.render.RenderKitFactory;
 import javax.faces.view.StateManagementStrategy;
 import javax.faces.view.ViewMetadata;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
 
 import org.apache.myfaces.shared.application.DefaultViewHandlerSupport;
 import org.apache.myfaces.shared.application.ViewHandlerSupport;
@@ -66,11 +69,11 @@ public abstract class JspViewDeclaration
       {
           // try to get (or create) a ResponseSwitch and turn off the output
           Object origResponse = context.getExternalContext().getResponse();
-          ResponseSwitch responseSwitch = ExternalContextUtils.getResponseSwitch(origResponse);
+          ResponseSwitch responseSwitch = getResponseSwitch(origResponse);
           if (responseSwitch == null)
           {
               // no ResponseSwitch installed yet - create one 
-              responseSwitch = ExternalContextUtils.createResponseSwitch(origResponse);
+              responseSwitch = createResponseSwitch(origResponse);
               if (responseSwitch != null)
               {
                   // install the ResponseSwitch
@@ -157,7 +160,7 @@ public abstract class JspViewDeclaration
       
       // try to enable the ResponseSwitch again (disabled in buildView())
       Object response = context.getExternalContext().getResponse();
-      ResponseSwitch responseSwitch = ExternalContextUtils.getResponseSwitch(response);
+      ResponseSwitch responseSwitch = getResponseSwitch(response);
       if (responseSwitch != null)
       {
           responseSwitch.setEnabled(true);
@@ -401,6 +404,51 @@ public abstract class JspViewDeclaration
   }
 
   /**
+   * Trys to obtain a ResponseSwitch from the Response.
+   * @param response
+   * @return if found, the ResponseSwitch, null otherwise
+   */
+  private static ResponseSwitch getResponseSwitch(Object response)
+  {
+      // unwrap the response until we find a ResponseSwitch
+      while (response != null)
+      {
+          if (response instanceof ResponseSwitch)
+          {
+              // found
+              return (ResponseSwitch) response;
+          }
+          if (response instanceof ServletResponseWrapper)
+          {
+              // unwrap
+              response = ((ServletResponseWrapper) response).getResponse();
+          }
+          // no more possibilities to find a ResponseSwitch
+          break; 
+      }
+      return null; // not found
+  }
+  
+  /**
+   * Try to create a ResponseSwitch for this response.
+   * @param response
+   * @return the created ResponseSwitch, if there is a ResponseSwitch 
+   *         implementation for the given response, null otherwise
+   */
+  private static ResponseSwitch createResponseSwitch(Object response)
+  {
+      if (response instanceof HttpServletResponse)
+      {
+          return new HttpServletResponseSwitch((HttpServletResponse) response);
+      }
+      else if (response instanceof ServletResponse)
+      {
+          return new ServletResponseSwitch((ServletResponse) response);
+      }
+      return null;
+  }
+
+  /**
    * Writes the response and replaces the state marker tags with the state information for the current context
    */
 /*  private static class StateMarkerAwareWriter extends Writer