You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by so...@apache.org on 2010/01/26 19:19:00 UTC
svn commit: r903348 [2/3] - in
/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0: ./ api/
api/src/ api/src/main/ api/src/main/java/ api/src/main/java/javax/
api/src/main/java/javax/portlet/ api/src/main/java/javax/portlet/faces/
api/sr...
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/faces-config.xml?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/faces-config.xml Tue Jan 26 18:18:56 2010
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
-
- <navigation-rule>
- <from-view-id>*</from-view-id>
- <navigation-case>
- <from-outcome>helloWorld</from-outcome>
- <to-view-id>/helloworld/index.jsp</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/helloworld/index.jsp</from-view-id>
- <navigation-case>
- <from-outcome>sayhello</from-outcome>
- <to-view-id>/helloworld/hello.jsp</to-view-id>
- </navigation-case>
- </navigation-rule>
- <managed-bean>
- <managed-bean-name>namebean</managed-bean-name>
- <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>helloWorld</from-outcome>
+ <to-view-id>/helloworld/index.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/helloworld/index.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>sayhello</from-outcome>
+ <to-view-id>/helloworld/hello.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <managed-bean>
+ <managed-bean-name>namebean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
\ No newline at end of file
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/faces-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/portlet.xml?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/portlet.xml (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/portlet.xml Tue Jan 26 18:18:56 2010
@@ -1,62 +1,62 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- 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 xml:language governing permissions and limitations
- under the License.
--->
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
- http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- id="BridgeDemo" version="2.0">
-
- <portlet>
- <description xml:lang="EN">MyFaces Portlet Bridge Demo Portlet</description>
- <portlet-name>portlet-bridge-demo</portlet-name>
- <display-name xml:lang="EN">MyFaces Portlet Bridge Demo</display-name>
- <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
-
- <init-param>
- <name>javax.portlet.faces.defaultViewId.view</name>
- <value>/index.jsp</value>
- </init-param>
-
- <init-param>
- <name>javax.portlet.faces.defaltViewId.edit</name>
- <value>/edit.jsp</value>
- </init-param>
-
- <init-param>
- <name>javax.portlet.faces.defaultViewId.help</name>
- <value>/help.jsp</value>
- </init-param>
-
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
-
- <supported-locale>en</supported-locale>
-
- <portlet-info>
- <title>MyFaces Portlet Bridge Demo</title>
- <short-title>Bridge Demo</short-title>
- </portlet-info>
- </portlet>
-
-</portlet-app>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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 xml:language governing permissions and limitations
+ under the License.
+-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ id="BridgeDemo" version="2.0">
+
+ <portlet>
+ <description xml:lang="EN">MyFaces Portlet Bridge Demo Portlet</description>
+ <portlet-name>portlet-bridge-demo</portlet-name>
+ <display-name xml:lang="EN">MyFaces Portlet Bridge Demo</display-name>
+ <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/index.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaltViewId.edit</name>
+ <value>/edit.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.help</name>
+ <value>/help.jsp</value>
+ </init-param>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>MyFaces Portlet Bridge Demo</title>
+ <short-title>Bridge Demo</short-title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/portlet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/web.xml?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/web.xml Tue Jan 26 18:18:56 2010
@@ -1,56 +1,56 @@
-<?xml version = '1.0' encoding = 'ISO-8859-1'?>
-<!--
- 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.
-
--->
-<!-- The Jetty Pluto Plugin needs to have a Webapp 2.3 web-xml. Don't know why. -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- version="2.5">
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.jsp</param-value>
- </context-param>
- <context-param>
- <param-name>com.sun.faces.validateXml</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <!-- Listener, to allow Jetty serving MyFaces apps -->
- <!-- TODO: is this needed anymore for jetty? I don't think so.. -->
- <!-- listener>
- <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
- </listener -->
-
- <!-- Faces Servlet -->
- <servlet>
- <servlet-name>faces</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- </servlet>
-
- <!-- Faces Servlet Mappings -->
- <!--
- In this demo application, I chose to use suffix mapping. I did this because it makes urls
- in the portlet world look nicer in the source. The portlet url should be the same
- reguardless.
- -->
- <servlet-mapping>
- <servlet-name>faces</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
-</web-app>
+<?xml version = '1.0' encoding = 'ISO-8859-1'?>
+<!--
+ 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.
+
+-->
+<!-- The Jetty Pluto Plugin needs to have a Webapp 2.3 web-xml. Don't know why. -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.jsp</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Listener, to allow Jetty serving MyFaces apps -->
+ <!-- TODO: is this needed anymore for jetty? I don't think so.. -->
+ <!-- listener>
+ <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener -->
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>faces</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ </servlet>
+
+ <!-- Faces Servlet Mappings -->
+ <!--
+ In this demo application, I chose to use suffix mapping. I did this because it makes urls
+ in the portlet world look nicer in the source. The portlet url should be the same
+ reguardless.
+ -->
+ <servlet-mapping>
+ <servlet-name>faces</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/edit.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/helloworld/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/helloworld/hello.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/helloworld/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/help.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/demo/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/examples/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -1,2 +1,4 @@
target
+*.jws
*.jpr
+.project
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/build.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/build.xml?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/build.xml (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/build.xml Tue Jan 26 18:18:56 2010
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<project name="myfaces_shared_tasks">
+
+ <target name="refactor-java-sources">
+ <!-- 1. Create output dir -->
+ <mkdir dir="${refactor.output.dir}" />
+ <!-- 2. Move and rename package dir "shared" to new name -->
+ <move todir="${refactor.output.dir}/org/apache/myfaces/${refactor.package.new}">
+ <fileset dir="${refactor.src.dir}/org/apache/myfaces/shared">
+ <include name="**/*.java"/>
+ </fileset>
+ </move>
+ <!-- 3. Rename occurrences of package "shared" by new name -->
+ <replace dir="${refactor.output.dir}"
+ token="org.apache.myfaces.shared."
+ value="org.apache.myfaces.${refactor.package.new}.">
+ <include name="**/*.java"/>
+ </replace>
+ </target>
+
+ <target name="refactor-resources">
+ <!-- 1. Create output dir -->
+ <mkdir dir="${refactor.output.dir}" />
+ <!-- 2. Move and rename package dir "shared" to new name -->
+ <move todir="${refactor.output.dir}/org/apache/myfaces/${refactor.package.new}">
+ <fileset dir="${refactor.src.dir}/org/apache/myfaces/shared">
+ <include name="**/*.properties"/>
+ <include name="**/*.xml"/>
+ </fileset>
+ </move>
+ <!-- 3. Rename occurrences of package "shared" new name -->
+ <replace dir="${refactor.output.dir}"
+ token="org.apache.myfaces.shared."
+ value="org.apache.myfaces.${refactor.package.new}.">
+ <include name="**/*.properties"/>
+ <include name="**/*.xml"/>
+ </replace>
+ </target>
+
+</project>
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/pom.xml?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/pom.xml (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/pom.xml Tue Jan 26 18:18:56 2010
@@ -56,6 +56,19 @@
<artifactId>portlet-bridge-api</artifactId>
<groupId>org.apache.myfaces.portlet-bridge</groupId>
</dependency>
+
+ <!-- Needed by the StateUtils in Shared -->
+ <dependency>
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-builder-annotations</artifactId>
+ </dependency>
+
+ <!-- Needed by the StateUtils in Shared -->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
</dependencies>
<distributionManagement>
@@ -66,12 +79,116 @@
</distributionManagement>
<build>
+ <resources>
+ <resource>
+ <!-- because adding an additional resourceRoot not possible with antrun yet -->
+ <directory>target/refactored-shared-sources/main/resources</directory>
+ </resource>
+ </resources>
+
<plugins>
<!-- Allows building of jdev projects (jdev:jdev target) -->
<plugin>
<groupId>org.apache.myfaces.trinidadbuild</groupId>
<artifactId>maven-jdev-plugin</artifactId>
</plugin>
+
+ <!-- Retrieves the unmodified shared resources -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals><goal>unpack</goal></goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.shared</groupId>
+ <artifactId>myfaces-shared-core</artifactId>
+ <version>${myfaces-shared.version}</version>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/unpacked-shared-sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Refactors sources to use the appropriate package name as per
+ http://myfaces.apache.org/shared12/index.html
+ -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>refactor-shared-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <tasks>
+ <property name="refactor.src.dir" value="${project.build.directory}/unpacked-shared-sources" />
+ <property name="refactor.output.dir" value="${project.build.directory}/refactored-shared-sources/main/java" />
+ <property name="refactor.package.new" value="shared_portlet" />
+ <ant dir="${project.basedir}" antfile="build.xml" inheritRefs="true" inheritAll="true">
+ <target name="refactor-java-sources" />
+ </ant>
+ </tasks>
+ <sourceRoot>${project.build.directory}/refactored-shared-sources/main/java</sourceRoot>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>refactor-resources</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <tasks>
+ <property name="refactor.src.dir" value="${project.build.directory}/unpacked-shared-sources" />
+ <property name="refactor.output.dir" value="${project.build.directory}/refactored-shared-sources/main/resources" />
+ <property name="refactor.package.new" value="shared_portlet" />
+ <ant dir="${project.basedir}" antfile="build.xml" inheritRefs="true" inheritAll="true">
+ <target name="refactor-resources" />
+ </ant>
+ </tasks>
+ <resourceRoot>${project.build.directory}/refactored-shared-sources/main/resources</resourceRoot> <!-- not yet supported -->
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <!--
+ - Add the unpacked shared sources directory as source directory into the pom datastructure,
+ - so that the -source jar includes them too; every .class file in the jar should have its
+ - source in the -source jar.
+ -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/refactored-shared-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationFactoryImpl.java?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationFactoryImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationFactoryImpl.java Tue Jan 26 18:18:56 2010
@@ -1,45 +1,45 @@
-/* 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.myfaces.portlet.faces.application;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-
-public class PortletApplicationFactoryImpl extends ApplicationFactory
-{
- private ApplicationFactory mHandler;
-
- public PortletApplicationFactoryImpl(ApplicationFactory handler)
- {
- mHandler = handler;
- }
-
- public Application getApplication()
- {
- return new PortletApplicationImpl(mHandler.getApplication());
- }
-
- public void setApplication(Application app)
- {
- mHandler.setApplication(app);
- }
-
+/* 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.myfaces.portlet.faces.application;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+
+public class PortletApplicationFactoryImpl extends ApplicationFactory
+{
+ private ApplicationFactory mHandler;
+
+ public PortletApplicationFactoryImpl(ApplicationFactory handler)
+ {
+ mHandler = handler;
+ }
+
+ public Application getApplication()
+ {
+ return new PortletApplicationImpl(mHandler.getApplication());
+ }
+
+ public void setApplication(Application app)
+ {
+ mHandler.setApplication(app);
+ }
+
}
\ No newline at end of file
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationImpl.java?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationImpl.java Tue Jan 26 18:18:56 2010
@@ -1,382 +1,81 @@
-/* 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.myfaces.portlet.faces.application;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import javax.el.ELContextListener;
-import javax.el.ELException;
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import javax.portlet.faces.BridgeUtil;
-import javax.portlet.faces.annotation.PortletNamingContainer;
-import javax.portlet.faces.component.PortletNamingContainerUIViewRoot;
-
-
-public class PortletApplicationImpl extends Application
-{
- private Application mWrapped;
-
- public PortletApplicationImpl(Application app)
- {
- mWrapped = app;
- }
-
- // The following concrete methods were added for JSF 1.2. They supply default
- // implementations that throw UnsupportedOperationException.
- // This allows old Application implementations to still work.
- public void addELResolver(ELResolver resolver) {
- mWrapped.addELResolver(resolver);
- }
-
- public ELResolver getELResolver() {
- return mWrapped.getELResolver();
- }
-
- public ResourceBundle getResourceBundle(FacesContext ctx, String name)
- throws FacesException, NullPointerException {
- return mWrapped.getResourceBundle(ctx, name);
- }
-
- public UIComponent createComponent(ValueExpression componentExpression,
- FacesContext facesContext,
- String componentType)
- throws FacesException, NullPointerException {
- return mWrapped.createComponent(componentExpression, facesContext, componentType);
- }
-
- public ExpressionFactory getExpressionFactory() {
- return mWrapped.getExpressionFactory();
- }
-
- public void addELContextListener(ELContextListener listener) {
- mWrapped.addELContextListener(listener);
- }
-
- public void removeELContextListener(ELContextListener listener) {
- mWrapped.removeELContextListener(listener);
- }
-
- public ELContextListener[] getELContextListeners() {
- return mWrapped.getELContextListeners();
- }
-
- public Object evaluateExpressionGet(FacesContext context,
- String expression,
- Class expectedType)
- throws ELException {
- return mWrapped.evaluateExpressionGet(context, expression, expectedType);
- }
-
- public javax.faces.event.ActionListener getActionListener()
- {
- return mWrapped.getActionListener();
- }
-
- public void setActionListener(javax.faces.event.ActionListener listener)
- {
- mWrapped.setActionListener(listener);
- }
-
- public Locale getDefaultLocale()
- {
- return mWrapped.getDefaultLocale();
- }
-
- public void setDefaultLocale(Locale locale)
- {
- mWrapped.setDefaultLocale(locale);
- }
-
- public String getDefaultRenderKitId()
- {
- return mWrapped.getDefaultRenderKitId();
- }
-
- public void setDefaultRenderKitId(String renderKitId)
- {
- mWrapped.setDefaultRenderKitId(renderKitId);
- }
-
- public String getMessageBundle()
- {
- return mWrapped.getMessageBundle();
- }
-
- public void setMessageBundle(String bundle)
- {
- mWrapped.setMessageBundle(bundle);
- }
-
- /**
- * Return the NavigationHandler object which is responsible for mapping from
- * a logical (viewid, fromAction, outcome) to the URL of a view to be rendered.
- */
- public javax.faces.application.NavigationHandler getNavigationHandler()
- {
- return mWrapped.getNavigationHandler();
- }
-
- public void setNavigationHandler(javax.faces.application.NavigationHandler handler)
- {
- mWrapped.setNavigationHandler(handler);
- }
-
- /**
- * Get the object used by the VariableResolver to read and write named properties
- * on java beans, Arrays, Lists and Maps. This object is used by the ValueBinding
- * implementation, and during the process of configuring "managed bean" properties.
- *
- * @deprecated
- */
- @Deprecated
- public javax.faces.el.PropertyResolver getPropertyResolver()
- {
- return mWrapped.getPropertyResolver();
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public void setPropertyResolver(javax.faces.el.PropertyResolver resolver)
- {
- mWrapped.setPropertyResolver(resolver);
- }
-
- /**
- * Get the object used to resolve expressions of form "#{...}".
- *
- * @deprecated
- */
- @Deprecated
- public javax.faces.el.VariableResolver getVariableResolver()
- {
- return mWrapped.getVariableResolver();
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public void setVariableResolver(javax.faces.el.VariableResolver resolver)
- {
- mWrapped.setVariableResolver(resolver);
- }
-
- public javax.faces.application.ViewHandler getViewHandler()
- {
- return mWrapped.getViewHandler();
- }
-
- public void setViewHandler(javax.faces.application.ViewHandler handler)
- {
- mWrapped.setViewHandler(handler);
- }
-
- public javax.faces.application.StateManager getStateManager()
- {
- return mWrapped.getStateManager();
- }
-
- public void setStateManager(javax.faces.application.StateManager manager)
- {
- mWrapped.setStateManager(manager);
- }
-
- /**
- * Define a new mapping from a logical "component type" to an actual java class name.
- * This controls what type is created when method createComponent of this class is
- * called.
- * <p>
- * Param componentClass must be the fully-qualified class name of some class
- * extending the UIComponent class. The class must have a default constructor,
- * as instances of it will be created using Class.newInstance.
- * <p>
- * It is permitted to override a previously defined mapping, ie to call this
- * method multiple times with the same componentType string. The createComponent
- * method will simply use the last defined mapping.
- */
- public void addComponent(String componentType,
- String componentClass)
- {
- mWrapped.addComponent(componentType, componentClass);
- }
-
-
- /**
- * Create a new UIComponent subclass, using the mappings defined by previous
- * calls to the addComponent method of this class.
- * <p>
- * @throws FacesException if there is no mapping defined for the specified
- * componentType, or if an instance of the specified type could not be
- * created for any reason.
- */
- public javax.faces.component.UIComponent createComponent(String componentType)
- throws FacesException
- {
- UIComponent component = mWrapped.createComponent(componentType);
- if (BridgeUtil.isPortletRequest() &&
- component.getClass() == UIViewRoot.class &&
- UIViewRoot.class.getAnnotation(PortletNamingContainer.class) == null
- )
- {
- // replace with our own UIViewRoot
- component = new PortletNamingContainerUIViewRoot();
- }
- return component;
- }
-
- /**
- * Create an object which has an associating "binding" expression tying the component
- * to a user property.
- * <p>
- * First the specified value-binding is evaluated; if it returns a non-null value then
- * the component "already exists" and so the resulting value is simply returned.
- * <p>
- * Otherwise a new UIComponent instance is created using the specified componentType,
- * and the new object stored via the provided value-binding before being returned.
- *
- * @deprecated
- */
- @Deprecated
- public javax.faces.component.UIComponent createComponent(
- javax.faces.el.ValueBinding componentBinding,
- javax.faces.context.FacesContext context,
- String componentType)
- throws FacesException
- {
- return mWrapped.createComponent(componentBinding, context, componentType);
- }
-
- public Iterator<String> getComponentTypes()
- {
- return mWrapped.getComponentTypes();
- }
-
- public void addConverter(String converterId,
- String converterClass)
- {
- mWrapped.addConverter(converterId, converterClass);
- }
-
- public void addConverter(Class targetClass,
- String converterClass)
- {
- mWrapped.addConverter(targetClass, converterClass);
- }
-
- public javax.faces.convert.Converter createConverter(String converterId)
- {
- return mWrapped.createConverter(converterId);
- }
-
- public javax.faces.convert.Converter createConverter(Class targetClass)
- {
- return mWrapped.createConverter(targetClass);
- }
-
- public Iterator<String> getConverterIds()
- {
- return mWrapped.getConverterIds();
- }
-
- @Override
- public Iterator<Class<?>> getConverterTypes()
- {
- return mWrapped.getConverterTypes();
- }
-
- /**
- * Create an object which can be used to invoke an arbitrary method via an
- * EL expression at a later time. This is similar to createValueBinding
- * except that it can invoke an arbitrary method (with parameters) rather
- * than just get/set a javabean property.
- * <p>
- * This is used to invoke ActionListener method, and ValueChangeListener
- * methods.
- *
- * @deprecated
- */
- @Deprecated
- public javax.faces.el.MethodBinding createMethodBinding(
- String ref, Class[] params)
- throws javax.faces.el.ReferenceSyntaxException
- {
- return mWrapped.createMethodBinding(ref, params);
- }
-
- public Iterator<Locale> getSupportedLocales()
- {
- return mWrapped.getSupportedLocales();
- }
-
- public void setSupportedLocales(Collection<Locale> locales)
- {
- mWrapped.setSupportedLocales(locales);
- }
-
- public void addValidator(String validatorId,
- String validatorClass)
- {
- mWrapped.addValidator(validatorId, validatorClass);
- }
-
- public javax.faces.validator.Validator createValidator(String validatorId)
- throws FacesException
- {
- return mWrapped.createValidator(validatorId);
- }
-
- public Iterator<String> getValidatorIds()
- {
- return mWrapped.getValidatorIds();
- }
-
- /**
- * Create an object which can be used to invoke an arbitrary method via an
- * EL expression at a later time. This is similar to createValueBinding
- * except that it can invoke an arbitrary method (with parameters) rather
- * than just get/set a javabean property.
- * <p>
- * This is used to invoke ActionListener method, and ValueChangeListener
- * methods.
- *
- * @deprecated
- */
- @Deprecated
- public javax.faces.el.ValueBinding createValueBinding(String ref)
- throws javax.faces.el.ReferenceSyntaxException
- {
- return mWrapped.createValueBinding(ref);
- }
-
-}
\ No newline at end of file
+/* 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.myfaces.portlet.faces.application;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationWrapper;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import javax.portlet.faces.BridgeUtil;
+import javax.portlet.faces.annotation.PortletNamingContainer;
+import javax.portlet.faces.component.PortletNamingContainerUIViewRoot;
+
+
+public class PortletApplicationImpl extends ApplicationWrapper
+{
+ private Application mWrapped;
+
+ public PortletApplicationImpl(Application app)
+ {
+ mWrapped = app;
+ }
+
+ /**
+ * Create a new UIComponent subclass, using the mappings defined by previous
+ * calls to the addComponent method of this class.
+ * <p>
+ * @throws FacesException if there is no mapping defined for the specified
+ * componentType, or if an instance of the specified type could not be
+ * created for any reason.
+ */
+ public javax.faces.component.UIComponent createComponent(String componentType)
+ throws FacesException
+ {
+ UIComponent component = getWrapped().createComponent(componentType);
+ if (BridgeUtil.isPortletRequest() &&
+ component.getClass() == UIViewRoot.class &&
+ UIViewRoot.class.getAnnotation(PortletNamingContainer.class) ==
+ null)
+ {
+ // replace with our own UIViewRoot
+ component = new PortletNamingContainerUIViewRoot();
+ }
+ return component;
+ }
+
+ public Application getWrapped()
+ {
+ return mWrapped;
+ }
+}
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletApplicationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletStateManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java?rev=903348&r1=903347&r2=903348&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java Tue Jan 26 18:18:56 2010
@@ -19,50 +19,22 @@
package org.apache.myfaces.portlet.faces.application;
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayWriter;
import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-
-import java.nio.ByteBuffer;
-
-import java.util.Locale;
-import java.util.Map;
-import java.util.logging.Level;
-import javax.faces.application.Application;
import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.application.StateManager;
+import javax.faces.application.Application;
import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
-
-import javax.portlet.MimeResponse;
import javax.portlet.PortletContext;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceResponse;
import javax.portlet.faces.Bridge;
import javax.portlet.faces.BridgeUtil;
import javax.portlet.faces.annotation.PortletNamingContainer;
import javax.portlet.faces.component.PortletNamingContainerUIViewRoot;
-import javax.portlet.filter.PortletResponseWrapper;
-
-import org.apache.myfaces.portlet.faces.application.PortletViewHandlerRenderResponseWrapper;
-import org.apache.myfaces.portlet.faces.application.PortletViewHandlerResourceResponseWrapper;
import org.apache.myfaces.portlet.faces.bridge.BridgeImpl;
-import org.apache.myfaces.portlet.faces.util.QueryString;
/**
* View handler implementation for JSF portlet bridge.
@@ -72,7 +44,7 @@
* TODO JSF 1.2 note: JSF 1.2 RI implements ViewHandler.renderView() differently in order to handle
* emitting non-JSF markup that follows the JSF tags after the JSF renders correctly. Unfortunately,
* the RI handles this by introducing several servlet dependencies. Currently, the bridge handles
- * this by overriding the renderView() and ignoring (not interleafing) the non-JSF markup - see HACK
+ * this by overriding the renderView() and ignoring (not interleaving) the non-JSF markup - see HACK
* below
*/
public class PortletViewHandlerImpl extends ViewHandlerWrapper
@@ -81,12 +53,13 @@
// the ViewHandler to delegate to
private ViewHandler mDelegate;
private Bridge.BridgeRenderPolicy mRenderPolicy = null;
-
+
public PortletViewHandlerImpl(ViewHandler handler)
{
mDelegate = handler;
}
+ @Override
public ViewHandler getWrapped()
{
return mDelegate;
@@ -98,8 +71,9 @@
// action URLs are processed by the bridge in encodeActionURL
// however the bridge extends Faces navigation rule support in that it
// allows a to-view-id element to contain an EL expression.
- // We recognize this EL expresion here and evaluate to a viewid
- // before delegating// Do nothing when not running in portlet request
+ // We recognize this EL expression here and evaluate to a viewid
+ // before delegating
+ // Do nothing when not running in portlet request
if (BridgeUtil.isPortletRequest())
{
@@ -151,9 +125,10 @@
{
// The Bridge extends Faces navigation rule support in that it
// allows a to-view-id element to contain an EL expression.
- // We recognize this EL expresion here and evaluate to a viewid
+ // We recognize this EL expression here and evaluate to a viewid
// before delegating
// Do nothing when not running in portlet request
+ // TODO: Should some of this logic be moved to the ViewDeclarationLanguage?
if (BridgeUtil.isPortletRequest())
{
@@ -287,375 +262,10 @@
}
catch (Throwable t)
{
- // catch all throws and swallow -- falling through to our own
- // render
- }
- }
-
- // suppress rendering if "rendered" property on the component is
- // false
- if (!viewToRender.isRendered())
- {
- return;
- }
-
- ExternalContext extContext = context.getExternalContext();
- MimeResponse mimeResponse = (MimeResponse) extContext.getResponse();
-
- try
- {
- extContext.getRequestMap().remove("javax.servlet.include.servlet_path");
- dispatchPageToBuildView(context, extContext, viewToRender);
- }
- catch (IOException e)
- {
- throw new FacesException(e);
- }
-
- // If a redirect occurred -- merely return
- // check here to see if a redirect occurred -- if so rerun doFacesRequest
- // for this new view
- QueryString redirectParams = (QueryString) context.getExternalContext()
- .getRequestMap().get(BridgeImpl.REDIRECT_VIEWPARAMS);
- if ((redirectParams != null))
- {
- return;
- }
-
- // set up the ResponseWriter
- RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderFactory.getRenderKit(context, viewToRender.getRenderKitId());
-
- ResponseWriter oldWriter = context.getResponseWriter();
- StringBuilderWriter strWriter = new StringBuilderWriter(context, 4096);
- ResponseWriter newWriter;
- if (null != oldWriter)
- {
- newWriter = oldWriter.cloneWithWriter(strWriter);
- }
- else
- {
- newWriter = renderKit.createResponseWriter(strWriter, null,
- mimeResponse.getCharacterEncoding());
- }
- context.setResponseWriter(newWriter);
-
- newWriter.startDocument();
-
- doRenderView(context, viewToRender);
-
- newWriter.endDocument();
-
- // replace markers in the body content and write it to response.
-
- ResponseWriter responseWriter;
-
- // Dispatch may have output to an OutputStream instead of a Writer
- Writer renderResponseWriter = null;
- try {
- renderResponseWriter = mimeResponse.getWriter();
- }
- catch (IllegalStateException ise) {
- // got this exception because we've called getOutputStream() previously
- renderResponseWriter = new BufferedWriter(
- new OutputStreamWriter(
- mimeResponse.getPortletOutputStream(),
- mimeResponse.getCharacterEncoding()));
- }
- if (null != oldWriter)
- {
- responseWriter = oldWriter.cloneWithWriter(renderResponseWriter);
- }
- else
- {
- responseWriter = newWriter.cloneWithWriter(renderResponseWriter);
- }
- context.setResponseWriter(responseWriter);
-
- strWriter.write(responseWriter);
- renderResponseWriter.flush();
-
- if (null != oldWriter)
- {
- context.setResponseWriter(oldWriter);
- }
-
- Object content = extContext.getRequestMap().get(Bridge.AFTER_VIEW_CONTENT);
- if (content != null)
- {
- if (content instanceof char[])
- {
- mimeResponse.getWriter().write(new String((char[]) content));
- }
- else if (content instanceof byte[])
- {
- mimeResponse.getWriter().write(new String((byte[]) content));
- }
- else
- {
- throw new IOException("PortletViewHandlerImpl: invalid" + "AFTER_VIEW_CONTENT buffer type");
- }
- }
- mimeResponse.flushBuffer();
- }
-
-
- private void dispatchPageToBuildView(FacesContext context,
- ExternalContext extContext,
- UIViewRoot viewToRender)
- throws IOException
- {
- String viewURI = viewToRender.getViewId();
-
- // update the JSTL locale attribute in request scope so that JSTL
- // picks up the locale from viewRoot. This attribute must be updated
- // before the JSTL setBundle tag is called because that is when the
- // new LocalizationContext object is created based on the locale.
- extContext.getRequestMap().put("javax.servlet.jsp.jstl.fmt.locale", context.getViewRoot().getLocale());
-
- // save the original response
- MimeResponse originalResponse = (MimeResponse) extContext.getResponse();
-
- // replace the response with our wrapper
- //TODO: need a separate response wrapper for resources
- PortletViewHandlerResourceResponseWrapper resourceResponseWrapper = null;
- PortletViewHandlerRenderResponseWrapper renderResponseWrapper = null;
- PortletResponseWrapper wrapped = null;
- if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE)
- {
- resourceResponseWrapper = new PortletViewHandlerResourceResponseWrapper((ResourceResponse)originalResponse/*, context.getViewRoot().getLocale()*/);
- wrapped = resourceResponseWrapper;
- }
- else
- {
- renderResponseWrapper = new PortletViewHandlerRenderResponseWrapper((RenderResponse) originalResponse/*, context.getViewRoot().getLocale()*/);
- wrapped = renderResponseWrapper;
- }
-
- if (!(wrapped instanceof PortletResponseWrapper))
- throw new IOException();
-
- extContext.setResponse(wrapped);
-
- // set request attribute indicating we can deal with content
- // that is supposed to be delayed until after JSF tree is ouput.
- extContext.getRequestMap().put(Bridge.RENDER_CONTENT_AFTER_VIEW, Boolean.TRUE);
-
-
- // build the view by executing the page
- extContext.dispatch(viewURI);
-
- // replace the original response
- extContext.setResponse(originalResponse);
-
- // Check to see if the portlet 1.0 bridge filter already put the content
- // into the attribute
-
- if (extContext.getRequestMap().get(Bridge.AFTER_VIEW_CONTENT) == null)
- {
- // Put the AFTER_VIEW_CONTENT into request scope
- // temporarily
- Object o = null;
- if (renderResponseWrapper != null)
- {
- o = (renderResponseWrapper.isChars()) ? (Object) renderResponseWrapper.getChars() : (Object) renderResponseWrapper.getBytes();
- }
- else if (resourceResponseWrapper != null)
- {
- o = (resourceResponseWrapper.isChars()) ? (Object) resourceResponseWrapper.getChars() : (Object) resourceResponseWrapper.getBytes();
- }
- if (o != null)
- {
- extContext.getRequestMap().put(Bridge.AFTER_VIEW_CONTENT, o);
- }
-
}
- }
-
-
- /**
- * <p>
- * This is a separate method to account for handling the content after the view tag.
- * </p>
- *
- * <p>
- * Create a new ResponseWriter around this response's Writer. Set it into the FacesContext, saving
- * the old one aside.
- * </p>
- *
- * <p>
- * call encodeBegin(), encodeChildren(), encodeEnd() on the argument <code>UIViewRoot</code>.
- * </p>
- *
- * <p>
- * Restore the old ResponseWriter into the FacesContext.
- * </p>
- *
- * <p>
- * Write out the after view content to the response's writer.
- * </p>
- *
- * <p>
- * Flush the response buffer, and remove the after view content from the request scope.
- * </p>
- *
- * @param context
- * the <code>FacesContext</code> for the current request
- * @param viewToRender
- * the view to render
- * @throws IOException
- * if an error occurs rendering the view to the client
- */
- private void doRenderView(FacesContext context, UIViewRoot viewToRender) throws IOException,
- FacesException
- {
- viewToRender.encodeAll(context);
- }
-
- private static final class StringBuilderWriter extends Writer
- {
- private StringBuilder mBuilder;
- private FacesContext mContext;
-
- // TODO: These bridge needs to use it's own constants here. This will
- // confine
- // us to only work with the R.I.
- private static final String RI_SAVESTATE_FIELD_MARKER = "~com.sun.faces.saveStateFieldMarker~";
- private static final String MYFACES_SAVESTATE_FIELD_MARKER = "<!-...@-->";
- private static String sSaveStateFieldMarker = null;
-
- public StringBuilderWriter(FacesContext context, int initialCapacity)
- {
- if (initialCapacity < 0)
- {
- throw new IllegalArgumentException();
- }
- mBuilder = new StringBuilder(initialCapacity);
- mContext = context;
- }
-
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException
- {
- if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0)
- {
- throw new IndexOutOfBoundsException();
- }
- else if (len == 0)
- {
- return;
- }
- mBuilder.append(cbuf, off, len);
- }
-
- @Override
- public void flush() throws IOException
- {
- }
-
- @Override
- public void close() throws IOException
- {
- }
-
- /**
- * Write a string.
- *
- * @param str
- * String to be written
- */
- @Override
- public void write(String str)
- {
- mBuilder.append(str);
- }
-
- @Override
- public void write(String str, int off, int len)
- {
- write(str.substring(off, off + len));
- }
-
- public StringBuilder getBuffer()
- {
- return mBuilder;
- }
-
- @Override
- public String toString()
- {
- return mBuilder.toString();
- }
-
- public void write(Writer writer) throws IOException
- {
-
- // See if we already have determined the SAVESTATE_FIELD_MARKER in use
- // If not then determine it and set for future use
- if (sSaveStateFieldMarker == null)
- {
- sSaveStateFieldMarker = determineSaveStateFieldMarker();
- }
-
- // TODO: Buffer?
- int pos = 0;
-
- // First we need to make sure we save the view
- StateManager stateManager = mContext.getApplication().getStateManager();
- Object stateToWrite = stateManager.saveView(mContext);
-
- // If we didn't find a savestate_field_marker don't search to replace for one.
- if (sSaveStateFieldMarker != null)
- {
- int markLen = sSaveStateFieldMarker.length();
- int tildeIdx = mBuilder.indexOf(sSaveStateFieldMarker);
- while (tildeIdx > 0)
- {
- writer.write(mBuilder.substring(pos, tildeIdx));
- stateManager.writeState(mContext, stateToWrite);
- pos = tildeIdx + markLen;
- tildeIdx = mBuilder.indexOf(sSaveStateFieldMarker, pos);
- }
- }
-
- writer.write(mBuilder.substring(pos));
- }
-
- private String determineSaveStateFieldMarker() throws IOException
- {
- // First check to see if there is one set in the configuration - if so test it first
- String marker = ((PortletContext)FacesContext.getCurrentInstance().
- getExternalContext().getContext()).getInitParameter(Bridge.SAVESTATE_FIELD_MARKER);
-
- if (isMarker(marker))
- {
- return marker;
- }
- // wasn't that one so test the Faces RI marker
- else if (isMarker(RI_SAVESTATE_FIELD_MARKER))
- {
- return RI_SAVESTATE_FIELD_MARKER;
- }
- // wasn't that one so test the MyFaces marker
- else if (isMarker(MYFACES_SAVESTATE_FIELD_MARKER))
- {
- return MYFACES_SAVESTATE_FIELD_MARKER;
- }
-
- // log that we didn't find a marker
- // However ignore this "exceptional" situation because its not so exceptional
- // MyFaces actually directly writes the state into the response more commonly
- // than it writes the Marker.
- mContext.getExternalContext().log("Unable to locate a SAVESTATE_FIELD_MARKER in response. This could be because your Faces environment doesn't write such a marker or because the bridge doesn't know the marker in use. If the later, configure the appropriate application init parameter javax.portlet.faces.SAVESTATE_FIELD_MARKER.");
- return null;
}
- private boolean isMarker(String marker)
- {
- return marker != null && mBuilder.indexOf(marker) >= 0;
- }
+ getViewDeclarationLanguage(context,viewToRender.getViewId()).renderView(context, viewToRender);
}
- // END TODO HACK JSF 1.2
}
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/AggregatingViewDeclatationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/AggregatingViewDeclatationLanguage.java?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/AggregatingViewDeclatationLanguage.java (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/AggregatingViewDeclatationLanguage.java Tue Jan 26 18:18:56 2010
@@ -0,0 +1,113 @@
+package org.apache.myfaces.portlet.faces.application.view;
+
+import java.beans.BeanInfo;
+import java.io.IOException;
+
+import javax.faces.application.Resource;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.view.StateManagementStrategy;
+import javax.faces.view.ViewDeclarationLanguage;
+import javax.faces.view.ViewMetadata;
+
+/**
+ * This is a VDL that redirects everything to the primary unless there is a
+ * and exception thrown in either buildView or renderView or renderview methods
+ * in which case it delegates.
+ *
+ * @param primary
+ * @param secondary
+ */
+class AggregatingViewDeclatationLanguage extends ViewDeclarationLanguage
+{
+ private ViewDeclarationLanguage mPrimary;
+ private ViewDeclarationLanguage mSecondary;
+
+ private boolean mRenderSecondary = false;
+
+ public AggregatingViewDeclatationLanguage(ViewDeclarationLanguage primary, ViewDeclarationLanguage secondary)
+ {
+ mPrimary = primary;
+ mSecondary = secondary;
+ }
+
+ @Override
+ public void buildView(FacesContext context, UIViewRoot root) throws IOException
+ {
+ if(!mRenderSecondary)
+ {
+ try
+ {
+ mPrimary.buildView(context, root);
+ return;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+
+ //There was an exception from the original renderView, I'm now
+ //going to use the portal's renderer
+
+ mSecondary.buildView(context, root);
+ }
+
+ @Override
+ public UIViewRoot createView(FacesContext arg0, String arg1)
+ {
+ return mPrimary.createView(arg0, arg1);
+ }
+
+ @Override
+ public BeanInfo getComponentMetadata(FacesContext arg0, Resource arg1)
+ {
+ return mPrimary.getComponentMetadata(arg0, arg1);
+ }
+
+ @Override
+ public Resource getScriptComponentResource(FacesContext arg0, Resource arg1)
+ {
+ return mPrimary.getScriptComponentResource(arg0, arg1);
+ }
+
+ @Override
+ public StateManagementStrategy getStateManagementStrategy(FacesContext arg0,
+ String arg1)
+ {
+ return mPrimary.getStateManagementStrategy(arg0, arg1);
+ }
+
+ @Override
+ public ViewMetadata getViewMetadata(FacesContext arg0, String arg1)
+ {
+ return mPrimary.getViewMetadata(arg0, arg1);
+ }
+
+ @Override
+ public void renderView(FacesContext context, UIViewRoot root) throws IOException
+ {
+ if(!mRenderSecondary)
+ {
+ try
+ {
+ mPrimary.renderView(context, root);
+ return;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+
+ //There was an exception from the original renderView, I'm now
+ //going to use the portal's renderer
+
+ mSecondary.renderView(context, root);
+ }
+
+ @Override
+ public UIViewRoot restoreView(FacesContext arg0, String arg1)
+ {
+ return mPrimary.restoreView(arg0, arg1);
+ }
+
+}
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletJspViewDeclarationLanguageImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletJspViewDeclarationLanguageImpl.java?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletJspViewDeclarationLanguageImpl.java (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletJspViewDeclarationLanguageImpl.java Tue Jan 26 18:18:56 2010
@@ -0,0 +1,127 @@
+package org.apache.myfaces.portlet.faces.application.view;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.portlet.MimeResponse;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceResponse;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUtil;
+
+import org.apache.myfaces.shared_portlet.view.JspViewDeclarationLanguageBase;
+import org.apache.myfaces.shared_portlet.view.ViewResponseWrapper;
+
+public class PortletJspViewDeclarationLanguageImpl extends
+ JspViewDeclarationLanguageBase
+{
+ private static final Logger sLOGGER = Logger.getLogger(PortletJspViewDeclarationLanguageImpl.class.getName());
+
+ @Override
+ protected void sendSourceNotFound(FacesContext context, String message)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void buildView(FacesContext context, UIViewRoot view) throws IOException
+ {
+ if(null == context)
+ {
+ //TODO: Localize Strings
+ throw new NullPointerException("FacesContext is null");
+ }
+
+ if(null == view)
+ {
+ //TODO: Localize Strings
+ throw new NullPointerException("UIViewRoot is null");
+ }
+
+ String viewId = view.getViewId();
+
+ ExternalContext ec = context.getExternalContext();
+ //TODO: Check to see if view is populated
+
+ // update the JSTL locale attribute in request scope so that JSTL
+ // picks up the locale from viewRoot. This attribute must be updated
+ // before the JSTL setBundle tag is called because that is when the
+ // new LocalizationContext object is created based on the locale.
+ // Unfortunately we need to put this attribute on directly because the
+ // JSTL Config.set API does not accommodate a portlet request. Quite
+ // possibly we may need an implementation adapter here but for now we
+ // can hard code it.
+
+ //TODO: MyFaces also sets the Locale on the response. Do we need to do this here?
+ ec.getRequestMap().put("javax.servlet.jsp.jstl.fmt.locale", context.getViewRoot().getLocale());
+
+ if (sLOGGER.isLoggable(Level.FINE))
+ {
+ sLOGGER.fine("Before dispacthMessage to viewId " + viewId);
+ }
+
+ // save the original response
+ MimeResponse originalResponse = (MimeResponse)ec.getResponse();
+
+ ViewResponseWrapper wrapped = null;
+
+ //TODO: Could this be done with an instanceof which is much faster?
+ if(BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE)
+ {
+ wrapped = new PortletViewHandlerResourceResponseWrapper((ResourceResponse)originalResponse);
+ }
+ else
+ {
+ wrapped = new PortletViewHandlerRenderResponseWrapper((RenderResponse) originalResponse);
+ }
+
+ ec.setResponse(wrapped);
+
+ // set request attribute indicating we can deal with content
+ // that is supposed to be delayed until after JSF tree is output.
+ ec.getRequestMap().put(Bridge.RENDER_CONTENT_AFTER_VIEW, Boolean.TRUE);
+
+ // build the view by executing the page
+ try
+ {
+ ec.dispatch(viewId);
+ }
+ finally
+ {
+ // replace the original response
+ ec.setResponse(originalResponse);
+ }
+
+ //This is for backward compatibility with the Portlet 1.0 bridge's filter
+ //It simply replaces the "wrapped" object we got from parsing the JSP.
+ final Object o = ec.getRequestMap().remove(Bridge.AFTER_VIEW_CONTENT);
+ if(null == o)
+ {
+ wrapped = new ViewResponseWrapper() {
+ Object buffer = o;
+
+ public void flushToWriter(Writer writer, String encoding)
+ throws IOException
+ {
+ if(buffer instanceof char[])
+ {
+ writer.write((char[]) buffer);
+ }
+ else
+ {
+ writer.write(new String((byte[]) buffer, encoding));
+ }
+ writer.flush();
+ }
+ };
+ }
+
+ setAfterViewTagResponseWrapper(ec, wrapped);
+ }
+}
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewDeclarationLanguageFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewDeclarationLanguageFactoryImpl.java?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewDeclarationLanguageFactoryImpl.java (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewDeclarationLanguageFactoryImpl.java Tue Jan 26 18:18:56 2010
@@ -0,0 +1,188 @@
+package org.apache.myfaces.portlet.faces.application.view;
+
+import java.util.regex.Pattern;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+import javax.faces.view.ViewDeclarationLanguageFactory;
+
+import javax.portlet.PortletContext;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUtil;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+
+/**
+ * This is an implementation of the ViewDeclarationLanguageFactory for the portal. This implementation first checks to see if
+ * we have a facelet view. If we do, we simply provide the ViewDeclarationLanguage object from the JSF Implementation. If we
+ * do NOT have a facelet, then the factory will provide an ViewDeclarationLanguage object that is appropriate to run JSP's
+ * according to the Bridge.RENDER_POLICY.
+ *
+ * @author sobryan
+ */
+public class PortletViewDeclarationLanguageFactoryImpl
+ extends ViewDeclarationLanguageFactory
+{
+ /**
+ * Disable facelets VDL from the current application project.
+ */
+ @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true,false")
+ public static final String PARAM_DISABLE_JSF_FACELET = "javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER";
+
+ private ViewDeclarationLanguageFactory mWrapped;
+ private Pattern mAcceptPatterns;
+ private String mExtension;
+ private Bridge.BridgeRenderPolicy mRenderPolicy;
+
+ public PortletViewDeclarationLanguageFactoryImpl(ViewDeclarationLanguageFactory wrapped)
+ {
+ mWrapped = wrapped;
+
+ ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
+
+ mAcceptPatterns = loadAcceptPattern(ec);
+ mExtension = loadFaceletExtension(ec);
+ }
+
+ public ViewDeclarationLanguage getViewDeclarationLanguage(String viewId)
+ {
+ ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
+ ViewDeclarationLanguage vdl = getWrapped().getViewDeclarationLanguage(viewId);
+
+ if (BridgeUtil.isPortletRequest() && !isFacelet(ec, viewId))
+ {
+ // If first time -- Get the renderPolicy from the context init parameter
+ if (mRenderPolicy == null)
+ {
+ PortletContext pCtx = (PortletContext) ec.getContext();
+ String policy = pCtx.getInitParameter(Bridge.RENDER_POLICY);
+ if (policy != null)
+ {
+ mRenderPolicy = Bridge.BridgeRenderPolicy.valueOf(policy);
+ }
+ else
+ {
+ mRenderPolicy = Bridge.BridgeRenderPolicy.DEFAULT;
+ }
+ }
+
+ switch(mRenderPolicy)
+ {
+ case ALWAYS_DELEGATE:
+ return new PortletJspViewDeclarationLanguageImpl();
+ case DEFAULT:
+ return new AggregatingViewDeclatationLanguage(vdl, new PortletJspViewDeclarationLanguageImpl());
+ }
+ }
+
+ return vdl;
+ }
+
+ @Override
+ public ViewDeclarationLanguageFactory getWrapped()
+ {
+ return mWrapped;
+ }
+
+ private boolean isFacelet(ExternalContext ec, String viewId)
+ {
+ String param = ec.getInitParameter(PARAM_DISABLE_JSF_FACELET);
+ if(null != param && Boolean.parseBoolean(param.toLowerCase()))
+ {
+ //Facelet support is disabled so this will never be a facelet
+ return false;
+ }
+
+ // Check extension first as it's faster than mappings
+ if (viewId.endsWith(mExtension))
+ {
+ // If the extension matches, it's a Facelet viewId.
+ return true;
+ }
+
+ // Otherwise, try to match the view identifier with the facelet mappings
+ return mAcceptPatterns != null && mAcceptPatterns.matcher(viewId).matches();
+
+ }
+
+ /**
+ * Load and compile a regular expression pattern built from the Facelet view mapping parameters.
+ *
+ * @param context
+ * the application's external context
+ *
+ * @return the compiled regular expression
+ */
+ //TODO: Expose these in Shared. They come from the MyFaces FaceletViewDeclarationStrategy
+ private Pattern loadAcceptPattern(ExternalContext context)
+ {
+ assert context != null;
+
+ String mappings = context.getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
+ if (mappings == null)
+ {
+ return null;
+ }
+
+ // Make sure the mappings contain something
+ mappings = mappings.trim();
+ if (mappings.length() == 0)
+ {
+ return null;
+ }
+
+ return Pattern.compile(toRegex(mappings));
+ }
+
+ //TODO: Expose these in Shared. They come from the MyFaces FaceletViewDeclarationStrategy
+ private String loadFaceletExtension(ExternalContext context)
+ {
+ assert context != null;
+
+ String suffix = context.getInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME);
+ if (suffix == null)
+ {
+ suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
+ }
+ else
+ {
+ suffix = suffix.trim();
+ if (suffix.length() == 0)
+ {
+ suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
+ }
+ }
+
+ return suffix;
+ }
+
+ /**
+ * Convert the specified mapping string to an equivalent regular expression.
+ *
+ * @param mappings
+ * le mapping string
+ *
+ * @return an uncompiled regular expression representing the mappings
+ */
+ //TODO: Expose these in Shared. They come from the MyFaces FaceletViewDeclarationStrategy
+ private String toRegex(String mappings)
+ {
+ assert mappings != null;
+
+ // Get rid of spaces
+ mappings = mappings.replaceAll("\\s", "");
+
+ // Escape '.'
+ mappings = mappings.replaceAll("\\.", "\\\\.");
+
+ // Change '*' to '.*' to represent any match
+ mappings = mappings.replaceAll("\\*", ".*");
+
+ // Split the mappings by changing ';' to '|'
+ mappings = mappings.replaceAll(";", "|");
+
+ return mappings;
+ }
+}
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerRenderResponseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerRenderResponseWrapper.java?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerRenderResponseWrapper.java (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerRenderResponseWrapper.java Tue Jan 26 18:18:56 2010
@@ -0,0 +1,126 @@
+/* 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.myfaces.portlet.faces.application.view;
+
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+import javax.portlet.RenderResponse;
+import javax.portlet.filter.RenderResponseWrapper;
+
+import org.apache.myfaces.shared_portlet.view.ViewResponseWrapper;
+
+
+class PortletViewHandlerRenderResponseWrapper extends RenderResponseWrapper implements ViewResponseWrapper
+{
+ private static final int WRITE_BUFFER_SIZE = 4096;
+
+ private ByteArrayOutputStream mBytes;
+ private CharArrayWriter mCharWriter;
+ private PrintWriter mPrintWriter;
+
+ PortletViewHandlerRenderResponseWrapper(RenderResponse response)
+ {
+ super(response);
+ }
+
+ @Override
+ public PrintWriter getWriter() throws java.io.IOException
+ {
+ if (null != mBytes)
+ {
+ throw new IllegalStateException();
+ }
+
+ if (mPrintWriter == null)
+ {
+ mCharWriter = new CharArrayWriter(WRITE_BUFFER_SIZE);
+ mPrintWriter = new PrintWriter(mCharWriter);
+ }
+
+ return mPrintWriter;
+ }
+
+ @Override
+ public OutputStream getPortletOutputStream() throws IOException
+ {
+ if (null != mPrintWriter)
+ {
+ throw new IllegalStateException();
+ }
+
+ if (mBytes == null)
+ {
+ mBytes = new ByteArrayOutputStream(WRITE_BUFFER_SIZE);
+ }
+
+ return mBytes;
+ }
+
+ public void resetBuffer()
+ {
+
+ super.resetBuffer();
+
+ if (null != mPrintWriter)
+ {
+ mPrintWriter.close();
+ mPrintWriter = null;
+ mCharWriter = null;
+ }
+
+ if (null != mBytes)
+ {
+ mBytes.reset();
+ mBytes = null;
+ }
+ }
+
+ @Override
+ public void reset()
+ {
+ resetBuffer();
+ super.reset();
+ }
+
+
+ @Override
+ public void flushBuffer() throws java.io.IOException
+ {
+ // noop
+ }
+
+ public void flushToWriter(Writer writer, String encoding) throws IOException
+ {
+ if(mCharWriter != null)
+ {
+ writer.write(mCharWriter.toCharArray());
+ }
+ else if(mBytes != null)
+ {
+ writer.write(new String(mBytes.toByteArray(), encoding));
+ }
+ writer.flush();
+ }
+}
Added: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerResourceResponseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerResourceResponseWrapper.java?rev=903348&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerResourceResponseWrapper.java (added)
+++ myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/application/view/PortletViewHandlerResourceResponseWrapper.java Tue Jan 26 18:18:56 2010
@@ -0,0 +1,126 @@
+/* Lic/* 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.myfaces.portlet.faces.application.view;
+
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+import javax.portlet.ResourceResponse;
+import javax.portlet.filter.ResourceResponseWrapper;
+
+import org.apache.myfaces.shared_portlet.view.ViewResponseWrapper;
+
+
+class PortletViewHandlerResourceResponseWrapper extends ResourceResponseWrapper implements ViewResponseWrapper
+{
+ private static final int WRITE_BUFFER_SIZE = 4096;
+
+ private ByteArrayOutputStream mBytes;
+ private CharArrayWriter mCharWriter;
+ private PrintWriter mPrintWriter;
+
+ PortletViewHandlerResourceResponseWrapper(ResourceResponse response)
+ {
+ super(response);
+ }
+
+ @Override
+ public PrintWriter getWriter() throws java.io.IOException
+ {
+ if (null != mBytes)
+ {
+ throw new IllegalStateException();
+ }
+
+ if (mPrintWriter == null)
+ {
+ mCharWriter = new CharArrayWriter(WRITE_BUFFER_SIZE);
+ mPrintWriter = new PrintWriter(mCharWriter);
+ }
+
+ return mPrintWriter;
+ }
+
+ @Override
+ public OutputStream getPortletOutputStream() throws IOException
+ {
+ if (null != mPrintWriter)
+ {
+ throw new IllegalStateException();
+ }
+
+ if (mBytes == null)
+ {
+ mBytes = new ByteArrayOutputStream(WRITE_BUFFER_SIZE);
+ }
+
+ return mBytes;
+ }
+
+ public void resetBuffer()
+ {
+
+ super.resetBuffer();
+
+ if (null != mPrintWriter)
+ {
+ mPrintWriter.close();
+ mPrintWriter = null;
+ mCharWriter = null;
+ }
+
+ if (null != mBytes)
+ {
+ mBytes.reset();
+ mBytes = null;
+ }
+ }
+
+ @Override
+ public void reset()
+ {
+ resetBuffer();
+ super.reset();
+ }
+
+ @Override
+ public void flushBuffer() throws java.io.IOException
+ {
+ // noop
+ }
+
+ public void flushToWriter(Writer writer, String encoding) throws IOException
+ {
+ if(mCharWriter != null)
+ {
+ writer.write(mCharWriter.toCharArray());
+ }
+ else if(mBytes != null)
+ {
+ writer.write(new String(mBytes.toByteArray(), encoding));
+ }
+ writer.flush();
+ }
+}
+
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 26 18:18:56 2010
@@ -0,0 +1,4 @@
+target
+*.jws
+*.jpr
+.project
Propchange: myfaces/portlet-bridge/core/branches/sobryan_portlet-bridge-3.0.0/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native