You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2011/02/18 01:29:56 UTC
svn commit: r1071846 [3/4] - in
/myfaces/portlet-bridge/core/branches/2.0.0-branch: ./ api/
api/src/main/resources/META-INF/ assembly/
assembly/src/main/resources/META-INF/ examples/ examples/assembly/
examples/blank/ examples/carstore/ examples/facele...
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDuke/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDuke/pom.xml?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDuke/pom.xml (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDuke/pom.xml Fri Feb 18 00:29:55 2011
@@ -1,274 +1,274 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>MyFaces Portlet Bridge HelloDuke Demo</name>
- <artifactId>portlet-bridge-helloDuke</artifactId>
- <packaging>war</packaging>
-
- <parent>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <artifactId>portlet-bridge-examples</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>portlet-bridge-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>portlet-bridge-impl</artifactId>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jdev-plugin</artifactId>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <configuration>
- <libraries>
- <library>JSP Runtime</library>
- </libraries>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>pluto-assemble</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <warName>${pom.artifactId}-pluto-${pom.version}</warName>
- <outputDirectory>${project.build.directory}/../../assembly/target/webapp</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- sets up the webapp for deployment to pluto 2.0 "mvn clean install -Ppluto" -->
- <profile>
- <id>pluto</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>2.0.0</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
-<!-- sets up the webapp for deployment to pluto 2.0 (this is included as its the command in 1.0 for building to 2 - i.e. backwards compat) "mvn clean install -Ppluto2" -->
- <profile>
- <id>pluto2</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>2.0.0</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- To run jetty, issue "mvn clean -PjettyConfig jetty:run" -->
- <profile>
- <id>jettyConfig</id>
- <dependencies>
- <dependency>
- <groupId>com.bekk.boss</groupId>
- <artifactId>maven-jetty-pluto-embedded</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
- <systemProperties>
- <systemProperty>
- <name>org.apache.pluto.embedded.portletIds</name>
- <value>portlet-bridge-helloDuke</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- By default the war examples uses mojarra and packages for a nonjavaee environment (includes the Faces jars)! :) -->
-
- <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have Mojarra packaged in the war: -->
- <profile>
- <id>mojarra-nonjavaee</id>
- <activation>
- <property>
- <name>!jsf</name>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- <properties>
- <jsf_implementation>JSF-RI</jsf_implementation>
- </properties>
- </profile>
-
- <!-- If you are running in a JavaEE environment (i.e. Faces is already deployed) and hence don't need to have Mojarra packaged in the war: -->
- <!-- mvn install -Djsf=mojarra-javaee -->
- <profile>
- <id>mojarra-javaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-javaee</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
- </dependencies>
- <properties>
- <jsf_implementation>JSF-RI</jsf_implementation>
- </properties>
- </profile>
-
-
- <!-- To use this examples using the MyFacesImplementation: mvn clean install -Djsf=myfaces-javaee -->
- <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
- <profile>
- <id>myfaces-javaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-javaee</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
-
-
-
- <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have MyFaces packaged in the war: -->
- <!-- mvn install -Djsf=myfaces-nonjavaee -->
- <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
- <profile>
- <id>myfaces-nonjavaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-nonjavaee</value>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-</project>
-
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>MyFaces Portlet Bridge HelloDuke Demo</name>
+ <artifactId>portlet-bridge-helloDuke</artifactId>
+ <packaging>war</packaging>
+
+ <parent>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge-examples</artifactId>
+ <version>2.0.0.1-PATCH</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-impl</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jdev-plugin</artifactId>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <configuration>
+ <libraries>
+ <library>JSP Runtime</library>
+ </libraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>pluto-assemble</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warName>${pom.artifactId}-pluto-${pom.version}</warName>
+ <outputDirectory>${project.build.directory}/../../assembly/target/webapp</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- sets up the webapp for deployment to pluto 2.0 "mvn clean install -Ppluto" -->
+ <profile>
+ <id>pluto</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+<!-- sets up the webapp for deployment to pluto 2.0 (this is included as its the command in 1.0 for building to 2 - i.e. backwards compat) "mvn clean install -Ppluto2" -->
+ <profile>
+ <id>pluto2</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- To run jetty, issue "mvn clean -PjettyConfig jetty:run" -->
+ <profile>
+ <id>jettyConfig</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.bekk.boss</groupId>
+ <artifactId>maven-jetty-pluto-embedded</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
+ <systemProperties>
+ <systemProperty>
+ <name>org.apache.pluto.embedded.portletIds</name>
+ <value>portlet-bridge-helloDuke</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- By default the war examples uses mojarra and packages for a nonjavaee environment (includes the Faces jars)! :) -->
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have Mojarra packaged in the war: -->
+ <profile>
+ <id>mojarra-nonjavaee</id>
+ <activation>
+ <property>
+ <name>!jsf</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+ <!-- If you are running in a JavaEE environment (i.e. Faces is already deployed) and hence don't need to have Mojarra packaged in the war: -->
+ <!-- mvn install -Djsf=mojarra-javaee -->
+ <profile>
+ <id>mojarra-javaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>mojarra-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+
+ <!-- To use this examples using the MyFacesImplementation: mvn clean install -Djsf=myfaces-javaee -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-javaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have MyFaces packaged in the war: -->
+ <!-- mvn install -Djsf=myfaces-nonjavaee -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-nonjavaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-nonjavaee</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
+
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDukeCoordination/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDukeCoordination/pom.xml?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDukeCoordination/pom.xml (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/helloDukeCoordination/pom.xml Fri Feb 18 00:29:55 2011
@@ -1,274 +1,274 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>MyFaces Portlet Bridge HelloDuke Coordination Demo</name>
- <artifactId>portlet-bridge-helloDukeCoordination</artifactId>
- <packaging>war</packaging>
-
- <parent>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <artifactId>portlet-bridge-examples</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>portlet-bridge-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>portlet-bridge-impl</artifactId>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jdev-plugin</artifactId>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <configuration>
- <libraries>
- <library>JSP Runtime</library>
- </libraries>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>pluto-assemble</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <warName>${pom.artifactId}-pluto-${pom.version}</warName>
- <outputDirectory>${project.build.directory}/../../assembly/target/webapp</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- sets up the webapp for deployment to pluto 2.0 "mvn clean install -Ppluto" -->
- <profile>
- <id>pluto</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>2.0.0</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
-<!-- sets up the webapp for deployment to pluto 2.0 (this is included as its the command in 1.0 for building to 2 - i.e. backwards compat) "mvn clean install -Ppluto2" -->
- <profile>
- <id>pluto2</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>2.0.0</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- To run jetty, issue "mvn clean -PjettyConfig jetty:run" -->
- <profile>
- <id>jettyConfig</id>
- <dependencies>
- <dependency>
- <groupId>com.bekk.boss</groupId>
- <artifactId>maven-jetty-pluto-embedded</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <configuration>
- <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
- <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
- <systemProperties>
- <systemProperty>
- <name>org.apache.pluto.embedded.portletIds</name>
- <value>portlet-bridge-helloDukeCoordination</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- By default the war examples uses mojarra and packages for a nonjavaee environment (includes the Faces jars)! :) -->
-
- <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have Mojarra packaged in the war: -->
- <profile>
- <id>mojarra-nonjavaee</id>
- <activation>
- <property>
- <name>!jsf</name>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- <properties>
- <jsf_implementation>JSF-RI</jsf_implementation>
- </properties>
- </profile>
-
- <!-- If you are running in a JavaEE environment (i.e. Faces is already deployed) and hence don't need to have Mojarra packaged in the war: -->
- <!-- mvn install -Djsf=mojarra-javaee -->
- <profile>
- <id>mojarra-javaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-javaee</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
- </dependencies>
- <properties>
- <jsf_implementation>JSF-RI</jsf_implementation>
- </properties>
- </profile>
-
-
- <!-- To use this examples using the MyFacesImplementation: mvn clean install -Djsf=myfaces-javaee -->
- <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
- <profile>
- <id>myfaces-javaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-javaee</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
-
-
-
- <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have MyFaces packaged in the war: -->
- <!-- mvn install -Djsf=myfaces-nonjavaee -->
- <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
- <profile>
- <id>myfaces-nonjavaee</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-nonjavaee</value>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-</project>
-
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>MyFaces Portlet Bridge HelloDuke Coordination Demo</name>
+ <artifactId>portlet-bridge-helloDukeCoordination</artifactId>
+ <packaging>war</packaging>
+
+ <parent>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge-examples</artifactId>
+ <version>2.0.0.1-PATCH</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-impl</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jdev-plugin</artifactId>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <configuration>
+ <libraries>
+ <library>JSP Runtime</library>
+ </libraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>pluto-assemble</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warName>${pom.artifactId}-pluto-${pom.version}</warName>
+ <outputDirectory>${project.build.directory}/../../assembly/target/webapp</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- sets up the webapp for deployment to pluto 2.0 "mvn clean install -Ppluto" -->
+ <profile>
+ <id>pluto</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+<!-- sets up the webapp for deployment to pluto 2.0 (this is included as its the command in 1.0 for building to 2 - i.e. backwards compat) "mvn clean install -Ppluto2" -->
+ <profile>
+ <id>pluto2</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- To run jetty, issue "mvn clean -PjettyConfig jetty:run" -->
+ <profile>
+ <id>jettyConfig</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.bekk.boss</groupId>
+ <artifactId>maven-jetty-pluto-embedded</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
+ <systemProperties>
+ <systemProperty>
+ <name>org.apache.pluto.embedded.portletIds</name>
+ <value>portlet-bridge-helloDukeCoordination</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- By default the war examples uses mojarra and packages for a nonjavaee environment (includes the Faces jars)! :) -->
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have Mojarra packaged in the war: -->
+ <profile>
+ <id>mojarra-nonjavaee</id>
+ <activation>
+ <property>
+ <name>!jsf</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+ <!-- If you are running in a JavaEE environment (i.e. Faces is already deployed) and hence don't need to have Mojarra packaged in the war: -->
+ <!-- mvn install -Djsf=mojarra-javaee -->
+ <profile>
+ <id>mojarra-javaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>mojarra-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+
+ <!-- To use this examples using the MyFacesImplementation: mvn clean install -Djsf=myfaces-javaee -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-javaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have MyFaces packaged in the war: -->
+ <!-- mvn install -Djsf=myfaces-nonjavaee -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-nonjavaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-nonjavaee</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
+
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/pom.xml?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/pom.xml (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/examples/pom.xml Fri Feb 18 00:29:55 2011
@@ -1,64 +1,64 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>MyFaces Portlet Bridge Examples</name>
- <artifactId>portlet-bridge-examples</artifactId>
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <artifactId>portlet-bridge</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
-
- <repositories>
- <repository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>apache-maven-snapshots</id>
- <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
- </repository>
- </repositories>
-
- <modules>
- <module>blank</module>
- <module>carstore</module>
- <module>facelets-guess</module>
- <module>guessNumber</module>
- <module>guessNumberMojarraFilter</module>
- <module>guessNumberMojarra_v04_to_v07_Wrapper</module>
- <module>guessNumberMyFacesFilter</module>
- <module>helloDuke</module>
- <module>helloDukeCoordination</module>
- </modules>
-
- <profiles>
- <profile>
- <id>prepare-release</id>
- <activation>
- <property>
- <name>prepareRelease</name>
- </property>
- </activation>
- <modules>
- <module>assembly</module>
- </modules>
- </profile>
-
- <profile>
- <id>perform-release</id>
- <activation>
- <property>
- <name>performRelease</name>
- <value>true</value>
- </property>
- </activation>
- <modules>
- <module>assembly</module>
- </modules>
- </profile>
- </profiles>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>MyFaces Portlet Bridge Examples</name>
+ <artifactId>portlet-bridge-examples</artifactId>
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge</artifactId>
+ <version>2.0.0.1-PATCH</version>
+ </parent>
+
+ <repositories>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>apache-maven-snapshots</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>blank</module>
+ <module>carstore</module>
+ <module>facelets-guess</module>
+ <module>guessNumber</module>
+ <module>guessNumberMojarraFilter</module>
+ <module>guessNumberMojarra_v04_to_v07_Wrapper</module>
+ <module>guessNumberMyFacesFilter</module>
+ <module>helloDuke</module>
+ <module>helloDukeCoordination</module>
+ </modules>
+
+ <profiles>
+ <profile>
+ <id>prepare-release</id>
+ <activation>
+ <property>
+ <name>prepareRelease</name>
+ </property>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>perform-release</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ </modules>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/pom.xml?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/pom.xml (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/pom.xml Fri Feb 18 00:29:55 2011
@@ -1,77 +1,77 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2006 The Apache Software Foundation.
-
- Licensed 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>MyFaces Portlet Bridge Implementation</name>
- <artifactId>portlet-bridge-impl</artifactId>
- <packaging>jar</packaging>
-
- <parent>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <artifactId>portlet-bridge</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <artifactId>servlet-api</artifactId>
- <groupId>javax.servlet</groupId>
- </dependency>
-
- <dependency>
- <artifactId>portlet-api</artifactId>
- <groupId>javax.portlet</groupId>
- </dependency>
-
- <dependency>
- <artifactId>jsp-api</artifactId>
- <groupId>javax.servlet.jsp</groupId>
- </dependency>
-
- <dependency>
- <artifactId>jsf-api</artifactId>
- <groupId>javax.faces</groupId>
- </dependency>
-
- <dependency>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <groupId>org.apache.geronimo.specs</groupId>
- </dependency>
-
- <dependency>
- <artifactId>portlet-bridge-api</artifactId>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- </dependency>
- </dependencies>
-
- <distributionManagement>
- <site>
- <id>apache-site</id>
- <url>scpexe://minotaur.apache.org/www/myfaces.apache.org/portlet-bridge/2.0/impl</url>
- </site>
- </distributionManagement>
-
- <build>
- <plugins>
- <!-- Allows building of jdev projects (jdev:jdev target) -->
- <plugin>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-jdev-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation.
+
+ Licensed 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>MyFaces Portlet Bridge Implementation</name>
+ <artifactId>portlet-bridge-impl</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge</artifactId>
+ <version>2.0.0.1-PATCH</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <artifactId>servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>portlet-api</artifactId>
+ <groupId>javax.portlet</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>jsp-api</artifactId>
+ <groupId>javax.servlet.jsp</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>jsf-api</artifactId>
+ <groupId>javax.faces</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <groupId>org.apache.geronimo.specs</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>portlet-bridge-api</artifactId>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ </dependency>
+ </dependencies>
+
+ <distributionManagement>
+ <site>
+ <id>apache-site</id>
+ <url>scpexe://minotaur.apache.org/www/myfaces.apache.org/portlet-bridge/2.0/impl</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <!-- Allows building of jdev projects (jdev:jdev target) -->
+ <plugin>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-jdev-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Fri Feb 18 00:29:55 2011
@@ -110,9 +110,12 @@ import javax.servlet.ServletRequestAttri
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionActivationListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionEvent;
+
import org.apache.myfaces.portlet.faces.bridge.wrapper.BridgePortletRequestWrapper;
import org.apache.myfaces.portlet.faces.bridge.wrapper.BridgeRenderRequestWrapper;
import org.apache.myfaces.portlet.faces.context.PortletExternalContextImpl;
@@ -2497,6 +2500,46 @@ public class BridgeImpl
}
}
}
+
+ // tests to see if any scopes exist that start with the given prefix
+ // used during session reactivation to test/remove session attr (listener) that is no longer needed
+ private boolean hasRequestScopes(String scopePrefix)
+ {
+
+ if (scopePrefix == null || mPortletConfig == null)
+ return false; // Nothing to do -- later case is the session is destroyed after the context
+
+ // Get the RequestScope Map and remove all entries/scopes with this prefix
+ PortletContext portletContext = mPortletConfig.getPortletContext();
+
+ // Get the request scope lock -- because its added during init it should
+ // always be there.
+ Object lock = portletContext.getAttribute(REQUEST_SCOPE_LOCK);
+ if (lock == null)
+ return false;
+
+ synchronized (lock)
+ {
+ // get the managedScopeMap
+ LRUMap requestScopeMap = (LRUMap) portletContext.getAttribute(REQUEST_SCOPE_MAP);
+
+ if (requestScopeMap != null)
+ {
+ Iterator<String> iterator = requestScopeMap.keySet().iterator();
+ while (iterator.hasNext())
+ {
+ String scopeId = iterator.next();
+ if (scopeId != null && scopeId.startsWith(scopePrefix))
+ {
+ // found one
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
private void removeRequestScopes(String scopePrefix)
{
@@ -2607,7 +2650,7 @@ public class BridgeImpl
// There is only one lifecycle instance within a webapp -- and lifecycles aren't thread safe
// This means we may have multiple listeners registered and/or multiple simulataneous requests
// So only do the work if the FacesContext of the event is equal to the one in the current thread
- if (context != FacesContext.getCurrentInstance())
+ if (context != FacesContext.getCurrentInstance() || !BridgeUtil.isPortletRequest())
{
return;
}
@@ -2651,7 +2694,7 @@ public class BridgeImpl
// There is only one lifecycle instance within a webapp -- and lifecycles aren't thread safe
// This means we may have multiple listeners registered and/or multiple simulataneous requests
// So only do the work if the FacesContext of the event is equal to the one in the current thread
- if (context != FacesContext.getCurrentInstance())
+ if (context != FacesContext.getCurrentInstance() || !BridgeUtil.isPortletRequest())
{
return;
}
@@ -2796,10 +2839,10 @@ public class BridgeImpl
}
}
- private final class RequestScopeListener
- implements HttpSessionBindingListener
+ private final class RequestScopeListener
+ implements HttpSessionBindingListener, HttpSessionActivationListener, Serializable
{
- String mScopePrefix = null;
+ String mScopePrefix = null;
public RequestScopeListener(String scopePrefix)
{
@@ -2813,8 +2856,46 @@ public class BridgeImpl
public void valueUnbound(HttpSessionBindingEvent event)
{
- // Call is in the BridgeImpl class
+ // Call is in the BridgeImpl class -- note check for null
+ // If we have passivated/reactivated
+ if (mScopePrefix != null)
+ {
+ removeRequestScopes(mScopePrefix);
+ }
+ }
+
+ public void sessionWillPassivate(HttpSessionEvent se)
+ {
+ // TODO: is passivate only called when the session is migrated or just saved?
+ // -- i.e. is this a safe time to remove the scopes from the AppContext in the "old" context?
+ // Until we get confirmation that it is -- do not remove
+ /*
removeRequestScopes(mScopePrefix);
+
+ RequestScopeListener rl = (RequestScopeListener) se.getSession().getAttribute(REQUEST_SCOPE_LISTENER);
+ if (rl != null && rl.equals(this))
+ {
+ se.getSession().removeAttribute(REQUEST_SCOPE_LISTENER);
+ }
+
+ mScopePrefix = null;
+ */
+
+ }
+
+ public void sessionDidActivate(HttpSessionEvent se)
+ {
+ // If we migrsated to a new Context or otherwise can't reach these scopes anymore then
+ // drop the listener.
+ if (!hasRequestScopes(mScopePrefix))
+ {
+ RequestScopeListener rl = (RequestScopeListener) se.getSession().getAttribute(REQUEST_SCOPE_LISTENER);
+ if (rl != null && rl.equals(this))
+ {
+ se.getSession().removeAttribute(REQUEST_SCOPE_LISTENER);
+ }
+ mScopePrefix = null;
+ }
}
}
}
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletFacesContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletFacesContextImpl.java?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletFacesContextImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletFacesContextImpl.java Fri Feb 18 00:29:55 2011
@@ -339,6 +339,8 @@ public class PortletFacesContextImpl ext
// This is done because some (local) portals run/render all portlets in the same request
PortletRequest request = (PortletRequest)mExternalContext.getRequest();
List<String> preExistingAttrs = (List<String>) request.getAttribute(BridgeImpl.PREEXISTING_ATTRIBUTE_NAMES);
+ if (preExistingAttrs != null)
+ {
ArrayList<String> removeList = (ArrayList<String>) new ArrayList(preExistingAttrs.size());
Enumeration<String> e = request.getAttributeNames();
while (e.hasMoreElements())
@@ -356,6 +358,7 @@ public class PortletFacesContextImpl ext
{
request.removeAttribute(iter.next());
}
+ }
if (mExternalContext != null && mExternalContext instanceof PortletExternalContextImpl)
{
Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java?rev=1071846&r1=1071845&r2=1071846&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java Fri Feb 18 00:29:55 2011
@@ -1,530 +1,558 @@
-/* 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.util;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A class encapsulating an HTTP query string.
- */
-public final class QueryString
-{
- private String mQueryString;
- private String mCharacterEncoding;
- private Map<String, List<Parameter>> mParameterMap;
- private List<Parameter> mParameterList;
- private List<String> mParameterNames;
-
- /**
- * Construct a <code>QueryString</code> from a pre-encoded string.
- */
- public QueryString(String queryString, String characterEncoding)
- {
- // We only work on regular QueryStrings not strictXhtml QueryStrings
- mQueryString = queryString.replace("&", "&");
- mCharacterEncoding = characterEncoding;
- }
-
- /**
- * Makes a copy of an existing <code>QueryString</code>.
- */
- public QueryString(QueryString source)
- {
- mQueryString = source.mQueryString;
- mCharacterEncoding = source.mCharacterEncoding;
- if (source.mParameterList != null)
- {
- mParameterList = new ArrayList<Parameter>(source.mParameterList);
- }
- }
-
- /**
- * Constructs an empty query string (parameters may be added later).
- */
- public QueryString(String characterEncoding)
- {
- mCharacterEncoding = characterEncoding;
- }
-
- /**
- * Constructs a query string from an old-fashioned array of PRE-ENCODED name-value pairs
- */
- public QueryString(String[][] args, String characterEncoding)
- {
- this(characterEncoding);
- for (String[] element : args)
- {
- addParameter(element[0], element[1], true);
- }
- }
-
- /**
- * Constructs a query string from a list of PRE-ENCODED name-value pairs
- */
- public QueryString(List<String[]> params, String characterEncoding)
- {
- this(characterEncoding);
-
- for (String[] pair : params)
- {
- // -= Simon Lessard =-
- // FIXME: Add if (pair == null) check
- addParameter(pair[0], pair[1], true);
- }
- }
-
- /**
- * Converts this object into an encoded query string.
- */
- @Override
- public String toString()
- {
- // Use appendTo to concatenate the parameters together
- if (mQueryString == null)
- {
- appendTo(new StringBuilder(200));
- }
- return mQueryString;
- }
-
- /**
- * Appends the contents of this object to the given buffer in encoded query string form.
- *
- * @param buff
- * the buffer to append to
- */
- public void appendTo(StringBuilder buff)
- {
- if (mQueryString == null)
- {
- // If we don't have a cached query string yet, generate it
- if (mParameterList == null || mParameterList.isEmpty())
- {
- // If we don't have any parameters at all, cache the empty string
- mQueryString = "";
- }
- else
- {
- // Remember the start position in the buffer, so that we can also
- // cache the concatenated string in mQueryString
- int startPos = buff.length();
-
- Iterator<Parameter> iter = mParameterList.iterator();
- Parameter param = iter.next();
- buff.append(param.getEncodedName()).append('=').append(param.getEncodedValue());
-
- while (iter.hasNext())
- {
- param = iter.next();
- buff.append('&').append(param.getEncodedName()).append('=')
- .append(param.getEncodedValue());
- }
-
- mQueryString = buff.substring(startPos);
- }
- }
- else
- {
- // If we have a cached query string, reuse it
- buff.append(mQueryString);
- }
- }
-
- public Enumeration<String> getParameterNames()
- {
- initParameterMap();
- return Collections.enumeration(mParameterNames);
- }
-
- public Map getParameterMap()
- {
- initParameterMap();
- return mParameterMap;
- }
-
- public int numParameters()
- {
- return (mParameterMap != null) ? mParameterMap.size() : 0;
- }
-
- public String getParameter(String name)
- {
- initParameterMap();
- List<Parameter> values = mParameterMap.get(name);
- return values == null ? null : values.get(0).getValue();
- }
-
- public Enumeration<String> getParameterValues(String name)
- {
- initParameterMap();
- List<Parameter> params = mParameterMap.get(name);
- if (params == null || params.isEmpty())
- {
- List<String> temp = Collections.emptyList();
- return Collections.enumeration(temp);
- }
-
- List<String> values = new ArrayList<String>(params.size());
- for (Parameter param : params)
- {
- values.add(param.getValue());
- }
-
- return Collections.enumeration(values);
- }
-
- public void addParameter(String name, String value)
- {
- addParameter(name, value, false);
- }
-
- public void addParameter(String name, String value, boolean isEncoded)
- {
- if (value == null)
- {
- return;
- }
- initParameterList();
-
- // Invalidate the query string
- mQueryString = null;
-
- // Update the parameter list
- Parameter param = new Parameter(name, value, isEncoded);
- mParameterList.add(param);
-
- // Update the parameter map if it is initialized
- if (mParameterMap != null)
- {
- String decodedName = param.getName();
- List<Parameter> values = mParameterMap.get(decodedName);
- if (values == null)
- {
- createParameterList(param);
- }
- else
- {
- values.add(param);
- }
- }
- }
-
- public void setParameter(String name, String value)
- {
- setParameter(name, value, false);
- }
-
- public void setParameter(String name, String value, boolean isEncoded)
- {
- if (value == null)
- {
- removeParameter(name, isEncoded);
- return;
- }
- initParameterMap();
-
- // Invalidate the query string
- mQueryString = null;
-
- // Update the map
- Parameter param = new Parameter(name, value, isEncoded);
- String decodedName = param.getName();
- List<Parameter> values = mParameterMap.get(decodedName);
- if (values == null)
- {
- createParameterList(param);
- mParameterList.add(param);
- }
- else
- {
- values.clear();
-
- // First, replace the existing occurence of the parameter
- int i = mParameterList.indexOf(param);
- mParameterList.set(i, param);
-
- // Now, remove any subsequent occurrences
- int j;
- while ((j = mParameterList.lastIndexOf(param)) > i)
- {
- mParameterList.remove(j);
- }
-
- values.add(param);
- }
- }
-
- public String removeParameter(String name)
- {
- return removeParameter(name, false);
- }
-
- public String removeParameter(String name, boolean isEncoded)
- {
- initParameterList();
-
- // Invalidate the query string
- mQueryString = null;
-
- // Create a template parameter for comparisons, so that we can avoid
- // decoding all parameter names in the list
- Parameter templateParam = new Parameter(name, "", isEncoded);
-
- // Update the parameter list
- Iterator<Parameter> i = mParameterList.iterator();
- Parameter firstParam = null;
- while (i.hasNext())
- {
- Parameter param = i.next();
- // Compare the parameter with our template (only the template name
- // will be encoded / decoded if necessary)
- if (templateParam.equals(param))
- {
- if (firstParam == null)
- {
- firstParam = param;
- }
-
- i.remove();
- }
- }
-
- if (firstParam == null)
- {
- return null;
- }
-
- // Update the map, if it is initialized and we found a parameter
- if (mParameterMap != null)
- {
- String decodedName = templateParam.getName();
- List<Parameter> values = mParameterMap.remove(decodedName);
- if (values != null)
- {
- mParameterNames.remove(decodedName);
- }
- }
-
- return isEncoded ? firstParam.getEncodedValue() : firstParam.getValue();
- }
-
- private void createParameterList(Parameter param)
- {
- String decodedName = param.getName();
-
- List<Parameter> values = new ArrayList<Parameter>(4);
- mParameterMap.put(decodedName, values);
-
- // Only add UNIQUE parameter names (preserving order)
- mParameterNames.add(decodedName);
-
- values.add(param);
- }
-
- private void initParameterMap()
- {
- if (mParameterMap == null)
- {
- initParameterList();
-
- // TODO: Constants
- mParameterMap = new HashMap<String, List<Parameter>>(30);
- mParameterNames = new ArrayList<String>(30);
- if (mParameterList.isEmpty())
- {
- return;
- }
-
- String decodedName;
-
- for (Parameter param : mParameterList)
- {
- decodedName = param.getName();
- List<Parameter> values = mParameterMap.get(decodedName);
- if (values == null)
- {
- createParameterList(param);
- }
- else
- {
- values.add(param);
- }
- }
- }
- }
-
- private void initParameterList()
- {
- if (mParameterList == null)
- {
- // TODO: Constant
- mParameterList = new ArrayList<Parameter>(30);
- int length;
- if (mQueryString == null || (length = mQueryString.length()) == 0)
- {
- return;
- }
- Parameter param;
- int lastPos = 0, nextPos, sepPos;
- do
- {
- nextPos = mQueryString.indexOf('&', lastPos);
- if (nextPos == -1)
- {
- nextPos = length;
- }
- sepPos = mQueryString.indexOf('=', lastPos);
- if (sepPos != -1 && sepPos < nextPos)
- {
- param = new Parameter(mQueryString.substring(lastPos, sepPos),
- mQueryString.substring(sepPos + 1, nextPos), true);
- }
- else
- {
- param = new Parameter(mQueryString.substring(lastPos, nextPos), "", true);
- }
- mParameterList.add(param);
- lastPos = nextPos + 1;
- } while (nextPos < length);
- }
- }
-
- private class Parameter
- {
- private String mName;
- private String mEncodedName;
-
- private String mValue;
- private String mEncodedValue;
-
- public Parameter(String name, String value, boolean encoded)
- {
- if (encoded)
- {
- mEncodedName = name;
- mEncodedValue = value;
- }
- else
- {
- mName = name;
- mValue = value;
- }
- }
-
- public String getName()
- {
- if (mName == null)
- {
- try
- {
- mName = HTTPUtils.decode(mEncodedName, mCharacterEncoding);
- }
- catch (UnsupportedEncodingException uee)
- {
- handleUnsupportedEncoding();
- }
- }
- return mName;
- }
-
- public String getEncodedName()
- {
- if (mEncodedName == null)
- {
- try
- {
- mEncodedName = HTTPUtils.encode(mName, mCharacterEncoding);
- }
- catch (UnsupportedEncodingException uee)
- {
- handleUnsupportedEncoding();
- }
- }
- return mEncodedName;
- }
-
- public String getValue()
- {
- if (mValue == null)
- {
- try
- {
- mValue = HTTPUtils.decode(mEncodedValue, mCharacterEncoding);
- }
- catch (UnsupportedEncodingException uee)
- {
- handleUnsupportedEncoding();
- }
- }
- return mValue;
- }
-
- public String getEncodedValue()
- {
- if (mEncodedValue == null)
- {
- try
- {
- mEncodedValue = HTTPUtils.encode(mValue, mCharacterEncoding);
- }
- catch (UnsupportedEncodingException uee)
- {
- handleUnsupportedEncoding();
- }
- }
- return mEncodedValue;
- }
-
- /**
- * Compares two parameters for name equality.
- *
- * Attempts not to invoke any lazy encoding or decoding in the passed in parameter - only in
- * this one.
- */
- @Override
- public boolean equals(Object o)
- {
- if (o == null || !(o instanceof Parameter))
- {
- return false;
- }
- Parameter p1 = (Parameter) o;
- return p1.mName != null && getName().equals(p1.mName) || p1.mEncodedName != null
- && getEncodedName().equals(p1.mEncodedName);
- }
- }
-
- private void handleUnsupportedEncoding()
- {
- throw new IllegalArgumentException(
- new StringBuilder(100)
- .append(
- "Unrecognized character encoding \"")
- .append(mCharacterEncoding)
- .append('"').toString());
- }
-}
+/* 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.util;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A class encapsulating an HTTP query string.
+ */
+public final class QueryString implements Serializable
+{
+ private String mQueryString;
+ private String mCharacterEncoding;
+ private Map<String, List<Parameter>> mParameterMap;
+ private List<Parameter> mParameterList;
+ private List<String> mParameterNames;
+ private String mFragment;
+
+ /**
+ * Construct a <code>QueryString</code> from a pre-encoded string.
+ */
+ public QueryString(String queryString, String characterEncoding)
+ {
+ // We only work on regular QueryStrings not strictXhtml QueryStrings
+ mQueryString = queryString.replace("&", "&");
+ mCharacterEncoding = characterEncoding;
+ }
+
+ /**
+ * Makes a copy of an existing <code>QueryString</code>.
+ */
+ public QueryString(QueryString source)
+ {
+ mQueryString = source.mQueryString;
+ mCharacterEncoding = source.mCharacterEncoding;
+ if (source.mParameterList != null)
+ {
+ mParameterList = new ArrayList<Parameter>(source.mParameterList);
+ }
+ }
+
+ /**
+ * Constructs an empty query string (parameters may be added later).
+ */
+ public QueryString(String characterEncoding)
+ {
+ mCharacterEncoding = characterEncoding;
+ }
+
+ /**
+ * Constructs a query string from an old-fashioned array of PRE-ENCODED name-value pairs
+ */
+ public QueryString(String[][] args, String characterEncoding)
+ {
+ this(characterEncoding);
+ for (String[] element : args)
+ {
+ addParameter(element[0], element[1], true);
+ }
+ }
+
+ /**
+ * Constructs a query string from a list of PRE-ENCODED name-value pairs
+ */
+ public QueryString(List<String[]> params, String characterEncoding)
+ {
+ this(characterEncoding);
+
+ for (String[] pair : params)
+ {
+ // -= Simon Lessard =-
+ // FIXME: Add if (pair == null) check
+ addParameter(pair[0], pair[1], true);
+ }
+ }
+
+ /**
+ * Converts this object into an encoded query string.
+ */
+ @Override
+ public String toString()
+ {
+ // Use appendTo to concatenate the parameters together
+ if (mQueryString == null)
+ {
+ appendTo(new StringBuilder(200));
+ }
+ return mQueryString;
+ }
+
+ /**
+ * Appends the contents of this object to the given buffer in encoded query string form.
+ *
+ * @param buff
+ * the buffer to append to
+ */
+ public void appendTo(StringBuilder buff)
+ {
+ if (mQueryString == null)
+ {
+ // If we don't have a cached query string yet, generate it
+ if (mParameterList == null || mParameterList.isEmpty())
+ {
+ // If we don't have any parameters at all, cache the empty string
+ mQueryString = "";
+ }
+ else
+ {
+ // Remember the start position in the buffer, so that we can also
+ // cache the concatenated string in mQueryString
+ int startPos = buff.length();
+
+ Iterator<Parameter> iter = mParameterList.iterator();
+ Parameter param = iter.next();
+ buff.append(param.getEncodedName()).append('=').append(param.getEncodedValue());
+
+ while (iter.hasNext())
+ {
+ param = iter.next();
+ buff.append('&').append(param.getEncodedName()).append('=')
+ .append(param.getEncodedValue());
+ }
+
+ mQueryString = buff.substring(startPos);
+ }
+
+ if (mFragment != null)
+ {
+ mQueryString += mFragment;
+ }
+ }
+ else
+ {
+ // If we have a cached query string, reuse it
+ buff.append(mQueryString);
+ }
+ }
+
+ public Enumeration<String> getParameterNames()
+ {
+ initParameterMap();
+ return Collections.enumeration(mParameterNames);
+ }
+
+ public Map getParameterMap()
+ {
+ initParameterMap();
+ return mParameterMap;
+ }
+
+ public int numParameters()
+ {
+ return (mParameterMap != null) ? mParameterMap.size() : 0;
+ }
+
+ public String getParameter(String name)
+ {
+ initParameterMap();
+ List<Parameter> values = mParameterMap.get(name);
+ return values == null ? null : values.get(0).getValue();
+ }
+
+ public Enumeration<String> getParameterValues(String name)
+ {
+ initParameterMap();
+ List<Parameter> params = mParameterMap.get(name);
+ if (params == null || params.isEmpty())
+ {
+ List<String> temp = Collections.emptyList();
+ return Collections.enumeration(temp);
+ }
+
+ List<String> values = new ArrayList<String>(params.size());
+ for (Parameter param : params)
+ {
+ values.add(param.getValue());
+ }
+
+ return Collections.enumeration(values);
+ }
+
+ public void addParameter(String name, String value)
+ {
+ addParameter(name, value, false);
+ }
+
+ public void addParameter(String name, String value, boolean isEncoded)
+ {
+ if (value == null)
+ {
+ return;
+ }
+ initParameterList();
+
+ // Invalidate the query string
+ mQueryString = null;
+
+ // Update the parameter list
+ Parameter param = new Parameter(name, value, isEncoded);
+ mParameterList.add(param);
+
+ // Update the parameter map if it is initialized
+ if (mParameterMap != null)
+ {
+ String decodedName = param.getName();
+ List<Parameter> values = mParameterMap.get(decodedName);
+ if (values == null)
+ {
+ createParameterList(param);
+ }
+ else
+ {
+ values.add(param);
+ }
+ }
+ }
+
+ public void setParameter(String name, String value)
+ {
+ setParameter(name, value, false);
+ }
+
+ public void setParameter(String name, String value, boolean isEncoded)
+ {
+ if (value == null)
+ {
+ removeParameter(name, isEncoded);
+ return;
+ }
+ initParameterMap();
+
+ // Invalidate the query string
+ mQueryString = null;
+
+ // Update the map
+ Parameter param = new Parameter(name, value, isEncoded);
+ String decodedName = param.getName();
+ List<Parameter> values = mParameterMap.get(decodedName);
+ if (values == null)
+ {
+ createParameterList(param);
+ mParameterList.add(param);
+ }
+ else
+ {
+ values.clear();
+
+ // First, replace the existing occurence of the parameter
+ int i = mParameterList.indexOf(param);
+ mParameterList.set(i, param);
+
+ // Now, remove any subsequent occurrences
+ int j;
+ while ((j = mParameterList.lastIndexOf(param)) > i)
+ {
+ mParameterList.remove(j);
+ }
+
+ values.add(param);
+ }
+ }
+
+ public String removeParameter(String name)
+ {
+ return removeParameter(name, false);
+ }
+
+ public String removeParameter(String name, boolean isEncoded)
+ {
+ initParameterList();
+
+ // Invalidate the query string
+ mQueryString = null;
+
+ // Create a template parameter for comparisons, so that we can avoid
+ // decoding all parameter names in the list
+ Parameter templateParam = new Parameter(name, "", isEncoded);
+
+ // Update the parameter list
+ Iterator<Parameter> i = mParameterList.iterator();
+ Parameter firstParam = null;
+ while (i.hasNext())
+ {
+ Parameter param = i.next();
+ // Compare the parameter with our template (only the template name
+ // will be encoded / decoded if necessary)
+ if (templateParam.equals(param))
+ {
+ if (firstParam == null)
+ {
+ firstParam = param;
+ }
+
+ i.remove();
+ }
+ }
+
+ if (firstParam == null)
+ {
+ return null;
+ }
+
+ // Update the map, if it is initialized and we found a parameter
+ if (mParameterMap != null)
+ {
+ String decodedName = templateParam.getName();
+ List<Parameter> values = mParameterMap.remove(decodedName);
+ if (values != null)
+ {
+ mParameterNames.remove(decodedName);
+ }
+ }
+
+ return isEncoded ? firstParam.getEncodedValue() : firstParam.getValue();
+ }
+
+ private void createParameterList(Parameter param)
+ {
+ String decodedName = param.getName();
+
+ List<Parameter> values = new ArrayList<Parameter>(4);
+ mParameterMap.put(decodedName, values);
+
+ // Only add UNIQUE parameter names (preserving order)
+ mParameterNames.add(decodedName);
+
+ values.add(param);
+ }
+
+ private void initParameterMap()
+ {
+ if (mParameterMap == null)
+ {
+ initParameterList();
+
+ // TODO: Constants
+ mParameterMap = new HashMap<String, List<Parameter>>(30);
+ mParameterNames = new ArrayList<String>(30);
+ if (mParameterList.isEmpty())
+ {
+ return;
+ }
+
+ String decodedName;
+
+ for (Parameter param : mParameterList)
+ {
+ decodedName = param.getName();
+ List<Parameter> values = mParameterMap.get(decodedName);
+ if (values == null)
+ {
+ createParameterList(param);
+ }
+ else
+ {
+ values.add(param);
+ }
+ }
+ }
+ }
+
+ private void initParameterList()
+ {
+ if (mParameterList == null)
+ {
+ // remove/deal with a fragment hanging on the end
+ initFragment();
+
+ // TODO: Constant
+ mParameterList = new ArrayList<Parameter>(30);
+ int length;
+ if (mQueryString == null || (length = mQueryString.length()) == 0)
+ {
+ return;
+ }
+ Parameter param;
+ int lastPos = 0, nextPos, sepPos;
+ do
+ {
+ nextPos = mQueryString.indexOf('&', lastPos);
+ if (nextPos == -1)
+ {
+ nextPos = length;
+ }
+ sepPos = mQueryString.indexOf('=', lastPos);
+ if (sepPos != -1 && sepPos < nextPos)
+ {
+ param = new Parameter(mQueryString.substring(lastPos, sepPos),
+ mQueryString.substring(sepPos + 1, nextPos), true);
+ }
+ else
+ {
+ param = new Parameter(mQueryString.substring(lastPos, nextPos), "", true);
+ }
+ mParameterList.add(param);
+ lastPos = nextPos + 1;
+ } while (nextPos < length);
+ }
+ }
+
+ private void initFragment()
+ {
+ if (mQueryString != null)
+ {
+ int i = mQueryString.indexOf('#');
+ if (i == 0)
+ {
+ mFragment = mQueryString;
+ mQueryString = "";
+ }
+ else if (i > 0)
+ {
+ mFragment = mQueryString.substring(i);
+ mQueryString = mQueryString.substring(0, i);
+ }
+ }
+ }
+
+ private class Parameter implements Serializable
+ {
+ private String mName;
+ private String mEncodedName;
+
+ private String mValue;
+ private String mEncodedValue;
+
+ public Parameter(String name, String value, boolean encoded)
+ {
+ if (encoded)
+ {
+ mEncodedName = name;
+ mEncodedValue = value;
+ }
+ else
+ {
+ mName = name;
+ mValue = value;
+ }
+ }
+
+ public String getName()
+ {
+ if (mName == null)
+ {
+ try
+ {
+ mName = HTTPUtils.decode(mEncodedName, mCharacterEncoding);
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ handleUnsupportedEncoding();
+ }
+ }
+ return mName;
+ }
+
+ public String getEncodedName()
+ {
+ if (mEncodedName == null)
+ {
+ try
+ {
+ mEncodedName = HTTPUtils.encode(mName, mCharacterEncoding);
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ handleUnsupportedEncoding();
+ }
+ }
+ return mEncodedName;
+ }
+
+ public String getValue()
+ {
+ if (mValue == null)
+ {
+ try
+ {
+ mValue = HTTPUtils.decode(mEncodedValue, mCharacterEncoding);
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ handleUnsupportedEncoding();
+ }
+ }
+ return mValue;
+ }
+
+ public String getEncodedValue()
+ {
+ if (mEncodedValue == null)
+ {
+ try
+ {
+ mEncodedValue = HTTPUtils.encode(mValue, mCharacterEncoding);
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ handleUnsupportedEncoding();
+ }
+ }
+ return mEncodedValue;
+ }
+
+ /**
+ * Compares two parameters for name equality.
+ *
+ * Attempts not to invoke any lazy encoding or decoding in the passed in parameter - only in
+ * this one.
+ */
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == null || !(o instanceof Parameter))
+ {
+ return false;
+ }
+ Parameter p1 = (Parameter) o;
+ return p1.mName != null && getName().equals(p1.mName) || p1.mEncodedName != null
+ && getEncodedName().equals(p1.mEncodedName);
+ }
+ }
+
+ private void handleUnsupportedEncoding()
+ {
+ throw new IllegalArgumentException(
+ new StringBuilder(100)
+ .append(
+ "Unrecognized character encoding \"")
+ .append(mCharacterEncoding)
+ .append('"').toString());
+ }
+}