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:41:34 UTC
svn commit: r1299936 - in /myfaces/core/branches/2.0.x: ./ impl/ parent/
shared/ shared/src/main/java/org/apache/myfaces/shared/util/
shared/src/main/java/org/apache/myfaces/shared/view/
shared/src/test/java/org/apache/myfaces/shared/util/
Author: lu4242
Date: Tue Mar 13 00:41:33 2012
New Revision: 1299936
URL: http://svn.apache.org/viewvc?rev=1299936&view=rev
Log:
MYFACES-3498 create shared-public module
Removed:
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/ArrayUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/ClassLoaderExtension.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/ExternalContextUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/LocaleUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/ParametrizableFacesMessage.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/RequestType.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/WebConfigParamUtils.java
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/util/_EmptyIterator.java
myfaces/core/branches/2.0.x/shared/src/test/java/org/apache/myfaces/shared/util/MessageUtilsTest.java
Modified:
myfaces/core/branches/2.0.x/impl/pom.xml
myfaces/core/branches/2.0.x/parent/pom.xml
myfaces/core/branches/2.0.x/pom.xml
myfaces/core/branches/2.0.x/shared/pom.xml
myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
Modified: myfaces/core/branches/2.0.x/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/pom.xml?rev=1299936&r1=1299935&r2=1299936&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/pom.xml (original)
+++ myfaces/core/branches/2.0.x/impl/pom.xml Tue Mar 13 00:41:33 2012
@@ -388,7 +388,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>1.3.3</version>
<executions>
<execution>
<phase>package</phase>
@@ -857,7 +856,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
@@ -945,6 +943,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/branches/2.0.x/parent/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/parent/pom.xml?rev=1299936&r1=1299935&r2=1299936&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/parent/pom.xml (original)
+++ myfaces/core/branches/2.0.x/parent/pom.xml Tue Mar 13 00:41:33 2012
@@ -127,6 +127,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>
@@ -267,6 +285,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/branches/2.0.x/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/pom.xml?rev=1299936&r1=1299935&r2=1299936&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/pom.xml (original)
+++ myfaces/core/branches/2.0.x/pom.xml Tue Mar 13 00:41:33 2012
@@ -34,7 +34,7 @@
consists of an API module (javax.faces.* classes) and an implementation module (org.apache.myfaces.* classes).
</description>
<version>2.0.13-SNAPSHOT</version>
- <url>http://myfaces.apache.org/core20</url>
+ <url>http://myfaces.apache.org/core20/module</url>
<issueManagement>
<system>jira</system>
@@ -51,6 +51,7 @@
<module>parent</module>
<module>api</module>
<module>implee6</module>
+ <module>shared-public</module>
<module>shared</module>
<module>impl</module>
<module>bundle</module>
Modified: myfaces/core/branches/2.0.x/shared/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/shared/pom.xml?rev=1299936&r1=1299935&r2=1299936&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/shared/pom.xml (original)
+++ myfaces/core/branches/2.0.x/shared/pom.xml Tue Mar 13 00:41:33 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>
Modified: myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java?rev=1299936&r1=1299935&r2=1299936&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java (original)
+++ myfaces/core/branches/2.0.x/shared/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java Tue Mar 13 00:41:33 2012
@@ -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