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 2012/03/13 01:50:55 UTC

svn commit: r1299937 - in /myfaces/core/trunk: ./ impl/ parent/ shared/ shared/src/assembler/ shared/src/main/java/org/apache/myfaces/shared/util/ shared/src/main/java/org/apache/myfaces/shared/view/

Author: lu4242
Date: Tue Mar 13 00:50:54 2012
New Revision: 1299937

URL: http://svn.apache.org/viewvc?rev=1299937&view=rev
Log:
MYFACES-3498 create shared-public module

Added:
    myfaces/core/trunk/shared/src/assembler/   (with props)
    myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml   (with props)
    myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml   (with props)
Removed:
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/ArrayUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/ClassLoaderExtension.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/ExternalContextUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/LocaleUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/ParametrizableFacesMessage.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/RequestType.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/WebConfigParamUtils.java
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/_EmptyIterator.java
Modified:
    myfaces/core/trunk/impl/pom.xml
    myfaces/core/trunk/parent/pom.xml
    myfaces/core/trunk/pom.xml
    myfaces/core/trunk/shared/pom.xml
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java

Modified: myfaces/core/trunk/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/pom.xml?rev=1299937&r1=1299936&r2=1299937&view=diff
==============================================================================
--- myfaces/core/trunk/impl/pom.xml (original)
+++ myfaces/core/trunk/impl/pom.xml Tue Mar 13 00:50:54 2012
@@ -503,7 +503,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
-                <version>1.3.3</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
@@ -972,7 +971,6 @@
                     <plugin>
                         <groupId>org.codehaus.mojo</groupId>
                         <artifactId>build-helper-maven-plugin</artifactId>
-                        <version>1.5</version>
                         <executions>
                             <execution>
                                 <id>attach-artifacts</id>
@@ -1060,6 +1058,16 @@
             <artifactId>myfaces-shared-impl</artifactId>
         </dependency>
          -->
+        
+        <!-- This is included in myfaces-impl-shared, but in eclipse
+             it is not detected, so an easy workaround is include it
+             as an optional dependency -->
+        <dependency>
+            <groupId>org.apache.myfaces.core.internal</groupId>
+            <artifactId>myfaces-impl-shared-public</artifactId>
+            <optional>true</optional> 
+        </dependency>
+         
         <dependency>
             <groupId>org.apache.myfaces.core.internal</groupId>
             <artifactId>myfaces-impl-shared</artifactId>

Modified: myfaces/core/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/parent/pom.xml?rev=1299937&r1=1299936&r2=1299937&view=diff
==============================================================================
--- myfaces/core/trunk/parent/pom.xml (original)
+++ myfaces/core/trunk/parent/pom.xml Tue Mar 13 00:50:54 2012
@@ -130,6 +130,24 @@
                 </plugin>
                 
                 <plugin>
+                    <artifactId>myfaces-javascript-plugin</artifactId>
+                    <groupId>org.apache.myfaces.buildtools</groupId>
+                    <version>1.0.1</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-shade-plugin</artifactId>
+                    <version>1.3.3</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>build-helper-maven-plugin</artifactId>
+                    <version>1.5</version>
+                </plugin>
+
+                <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-idea-plugin</artifactId>
                     <version>2.1</version>
@@ -270,6 +288,12 @@
 
             <dependency>
                 <groupId>org.apache.myfaces.core.internal</groupId>
+                <artifactId>myfaces-impl-shared-public</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            
+            <dependency>
+                <groupId>org.apache.myfaces.core.internal</groupId>
                 <artifactId>myfaces-impl-shared</artifactId>
                 <version>${project.version}</version>
             </dependency>

Modified: myfaces/core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/pom.xml?rev=1299937&r1=1299936&r2=1299937&view=diff
==============================================================================
--- myfaces/core/trunk/pom.xml (original)
+++ myfaces/core/trunk/pom.xml Tue Mar 13 00:50:54 2012
@@ -52,6 +52,7 @@
         <module>api</module>
         <module>shaded-impl</module>
         <module>implee6</module>
+        <module>shared-public</module>
         <module>shared</module>
         <module>impl</module>
         <module>bundle</module>

Modified: myfaces/core/trunk/shared/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/pom.xml?rev=1299937&r1=1299936&r2=1299937&view=diff
==============================================================================
--- myfaces/core/trunk/shared/pom.xml (original)
+++ myfaces/core/trunk/shared/pom.xml Tue Mar 13 00:50:54 2012
@@ -45,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-public</artifactId>
+            <optional>true</optional> 
+        </dependency>
 
         <!-- Servlet 2.5 -->
         <dependency>
@@ -114,9 +120,40 @@
          </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-public</include>
+                  </includes>
+              </artifactSet>
+              <filters>
+                  <filter>
+                      <artifact>org.apache.myfaces.core.internal:myfaces-impl-shared-public</artifact>
+                      <includes>
+                          <include>org/apache/myfaces/**</include>
+                      </includes>
+                      <excludes>
+                          <exclude>META-INF/**</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>
@@ -137,7 +174,6 @@
       <plugin>
           <artifactId>myfaces-javascript-plugin</artifactId>
           <groupId>org.apache.myfaces.buildtools</groupId>
-          <version>1.0.1</version>
           <extensions>true</extensions>
           <executions>
                <execution>
@@ -196,17 +232,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>

Propchange: myfaces/core/trunk/shared/src/assembler/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml?rev=1299937&view=auto
==============================================================================
--- myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml (added)
+++ myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml Tue Mar 13 00:50:54 2012
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<assembler>
+    <scripts>
+        <script>
+            <fileName>oamSubmit.js</fileName>
+            <includes>
+                <include>**/_impl/oamSubmit.js</include>
+            </includes>
+        </script>
+    </scripts>
+</assembler>

Propchange: myfaces/core/trunk/shared/src/assembler/myfacesscripts-compiler.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml?rev=1299937&view=auto
==============================================================================
--- myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml (added)
+++ myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml Tue Mar 13 00:50:54 2012
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<assembler>
+    <scripts>
+        <script>
+            <fileName>oamSubmit-uncompressed.js</fileName>
+            <includes>
+                <include>**/_impl/oamSubmit.js</include>
+            </includes>
+        </script>
+    </scripts>
+</assembler>

Propchange: myfaces/core/trunk/shared/src/assembler/myfacesscripts-uncompressed-compiler.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java?rev=1299937&r1=1299936&r2=1299937&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java Tue Mar 13 00:50:54 2012
@@ -38,12 +38,14 @@ import javax.faces.render.RenderKitFacto
 import javax.faces.view.StateManagementStrategy;
 import javax.faces.view.ViewDeclarationLanguage;
 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;
 import org.apache.myfaces.shared.config.MyfacesConfig;
 import org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils;
-import org.apache.myfaces.shared.util.ExternalContextUtils;
 
 
 public abstract class JspViewDeclarationLanguageBase extends ViewDeclarationLanguageBase
@@ -73,11 +75,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
@@ -170,7 +172,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);
@@ -416,6 +418,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