You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2018/01/05 13:41:35 UTC
svn commit: r1820295 - in /myfaces/core/branches/2.3.x: api/ impl-test/
impl/ impl/src/main/java/org/apache/myfaces/context/servlet/
impl/src/main/java/org/apache/myfaces/util/ parent/ shared-public/ shared/
Author: tandraschko
Date: Fri Jan 5 13:41:34 2018
New Revision: 1820295
URL: http://svn.apache.org/viewvc?rev=1820295&view=rev
Log:
MYFACES-4141 JSF 2.3 Spec Issue 1436 - MyFaces Implementation requires Server Push functionality
Modified:
myfaces/core/branches/2.3.x/api/pom.xml
myfaces/core/branches/2.3.x/impl-test/pom.xml
myfaces/core/branches/2.3.x/impl/pom.xml
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java
myfaces/core/branches/2.3.x/parent/pom.xml
myfaces/core/branches/2.3.x/shared-public/pom.xml
myfaces/core/branches/2.3.x/shared/pom.xml
Modified: myfaces/core/branches/2.3.x/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/pom.xml (original)
+++ myfaces/core/branches/2.3.x/api/pom.xml Fri Jan 5 13:41:34 2018
@@ -39,9 +39,9 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/api</developerConnection>
<url>http://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/api</url>
</scm>
-
+
<build>
-
+
<resources>
<!-- standard resources -->
<resource>
@@ -69,9 +69,9 @@
<directory>src/main/javascript/META-INF/resources/myfaces/api</directory>
<targetPath>META-INF/internal-resources/org.apache.myfaces.core.api</targetPath>
</resource>
-
+
</resources>
-
+
<plugins>
<plugin>
@@ -97,13 +97,13 @@
<excludes>
<!-- dojo has combined new bsd + AFL 2.1 license -->
<exclude>src/main/resources/META-INF/licenses/dojo-LICENSE.TXT</exclude>
-
+
<!-- facelets has non-standard APL license -->
<exclude>src/main/resources/META-INF/licenses/facelets-LICENSE.txt</exclude>
</excludes>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -111,7 +111,7 @@
<excludes>javax/faces/component/**/*.java</excludes>
</configuration>
</plugin>
-
+
<!-- compilation and compression of our javascripts -->
<plugin>
<artifactId>myfaces-javascript-plugin</artifactId>
@@ -321,7 +321,7 @@
</configuration>
</plugin>
- <!--
+ <!--
berlios jsunit under apache2 license to cover javascript core routines which
do not have to rely on a browser or can work on browser mockups!
@@ -458,10 +458,10 @@
</plugin>
</plugins>
-
+
</build>
-
+
<profiles>
<!-- TODO jakobk: we could change this to -Papache-release -->
@@ -579,7 +579,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
-->
</plugins>
</build>
@@ -625,13 +625,13 @@
</profiles>
-
+
<dependencies>
<!--
NOTE that all versions and scopes are defined in the parent dependencyManagement section
- (except for optional=true due to a maven bug).
+ (except for optional=true due to a maven bug).
-->
- <!-- Servlet 3.1 -->
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
@@ -666,29 +666,29 @@
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-annotations</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_1.1_spec</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket-api</artifactId>
</dependency>
-
+
<!-- TEST DEPENDENCIES -->
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.myfaces.test</groupId>
<artifactId>myfaces-test23</artifactId>
@@ -713,7 +713,7 @@
<groupId>jmock</groupId>
<artifactId>jmock-cglib</artifactId>
</dependency>
-
+
<dependency>
<groupId>de.berlios.jsunit</groupId>
<artifactId>jsunit-maven2-plugin</artifactId>
@@ -724,14 +724,14 @@
<artifactId>commons-beanutils</artifactId>
<scope>test</scope> <!-- normally scope=compile, but here only for tests needed - TODO jakobk really? -->
</dependency>
-
+
</dependencies>
-
+
<reporting>
-
+
<plugins>
-
+
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
@@ -747,7 +747,7 @@
</tags>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-jsdoc-plugin</artifactId>
@@ -779,12 +779,12 @@
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
-
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
</plugin>
-
+
<!-- override PMD settings to set targetJdk -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
@@ -813,7 +813,7 @@
</plugin>
</plugins>
-
+
</reporting>
</project>
Modified: myfaces/core/branches/2.3.x/impl-test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl-test/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl-test/pom.xml (original)
+++ myfaces/core/branches/2.3.x/impl-test/pom.xml Fri Jan 5 13:41:34 2018
@@ -34,11 +34,11 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/impl-test</developerConnection>
<url>http://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/impl-test</url>
</scm>
-
+
<properties>
<openwebbeans.version>1.2.1</openwebbeans.version>
</properties>
-
+
<build>
<plugins>
<plugin>
@@ -51,7 +51,7 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin>
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -91,7 +91,7 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${project.version}</version>
- <classifier>test-sources</classifier>
+ <classifier>test-sources</classifier>
<outputDirectory>${project.build.directory}/generated-sources/myfaces-impl</outputDirectory>
<includes>org/apache/myfaces/mc/**/*.java</includes>
<excludes>**/*.class,**/META-INF/**</excludes>
@@ -130,7 +130,7 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${project.version}</version>
- <classifier>test-sources</classifier>
+ <classifier>test-sources</classifier>
</artifactItem>
</artifactItems>
<includes>org/apache/myfaces/mc/**/*.java</includes>
@@ -139,7 +139,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
</plugins>
</build>
</profile>
@@ -154,7 +154,7 @@
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared-public</artifactId>
- <scope>provided</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
@@ -176,8 +176,8 @@
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
-
- <!-- Servlet 3.1 -->
+
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
@@ -231,5 +231,5 @@
<optional>true</optional>
</dependency>
</dependencies>
-
+
</project>
Modified: myfaces/core/branches/2.3.x/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/pom.xml (original)
+++ myfaces/core/branches/2.3.x/impl/pom.xml Fri Jan 5 13:41:34 2018
@@ -25,7 +25,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
-
+
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<name>Apache MyFaces JSF-2.3 Core Impl</name>
@@ -39,13 +39,13 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/impl</developerConnection>
<url>http://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/impl</url>
</scm>
-
+
<properties>
<openwebbeans.version>1.6.3</openwebbeans.version>
</properties>
-
+
<build>
-
+
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -54,7 +54,7 @@
</excludes>
</resource>
</resources>
-
+
<plugins>
<plugin>
@@ -74,14 +74,14 @@
</execution>
</executions>
</plugin>
-
+
<!-- license checker needs to exclude some kinds of files -->
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
-
+
<!-- The xsd files are CDDL+GLP:
Category B: Reciprocal Licenses
"For small amounts of source that is directly consumed by the ASF product
@@ -98,7 +98,7 @@
<!-- facelets has non-standard APL license -->
<exclude>src/main/resources/META-INF/licenses/facelets-LICENSE.txt</exclude>
<exclude>src/main/resources/META-INF/licenses/omnifaces-LICENSE.txt</exclude>
-
+
<!-- services files are trivial config files with no comments -->
<exclude>src/test/resources/META-INF/services/org.apache.myfaces.config.annotation.LifecycleProvider</exclude>
<exclude>src/main/resources/META-INF/services/org.apache.myfaces.config.annotation.LifecycleProvider</exclude>
@@ -112,7 +112,7 @@
</excludes>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -126,13 +126,13 @@
org/apache/myfaces/webapp/WebConfigParamsLogger.java</excludes>
</configuration>
</plugin>
-
+
<!-- myfaces-build-plugin - we generate a lot of stuff with this plugin (see executions) -->
<plugin>
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
<executions>
-
+
<execution>
<id>makemyfacesmetadata</id>
<configuration>
@@ -145,7 +145,7 @@
<goal>build-metadata</goal>
</goals>
</execution>
-
+
<execution>
<id>makeWebConfigParamsLogger</id>
<configuration>
@@ -162,7 +162,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>makefacesconfig</id>
<configuration>
@@ -204,7 +204,7 @@
<goal>make-tags</goal>
</goals>
</execution>
-
+
<execution>
<id>makecoretld</id>
<configuration>
@@ -247,7 +247,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<!--
To generate facelet taglib doc we need to create alternate facelets files
so taglibdoc goal can extract the required information and create html files.
@@ -276,7 +276,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_html_facelet_tld</id>
<configuration>
@@ -324,7 +324,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_ui_facelet_tld</id>
<configuration>
@@ -348,7 +348,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_composite_facelet_tld</id>
<configuration>
@@ -372,7 +372,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_fn_facelet_tld</id>
<configuration>
@@ -397,7 +397,7 @@
</execution>
<!-- START XSD GENERATION -->
-
+
<execution>
<id>make_core_facelet_xsd</id>
<configuration>
@@ -420,7 +420,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_html_facelet_xsd</id>
<configuration>
@@ -464,7 +464,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_ui_facelet_xsd</id>
<configuration>
@@ -486,7 +486,7 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
<execution>
<id>make_composite_facelet_xsd</id>
<configuration>
@@ -624,7 +624,7 @@
</executions>
</plugin>
-
+
<!-- generate a -tests.jar too -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
@@ -653,7 +653,7 @@
</archive>
</configuration>
</plugin>
-
+
<!-- run test-cases -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
@@ -781,7 +781,7 @@
</execution>
</executions>
</plugin>
-
+
</plugins>
</build>
@@ -806,7 +806,7 @@
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
<executions>
-
+
<execution>
<id>site-tagdoc-content</id>
<configuration>
@@ -844,20 +844,20 @@
<goal>make-config</goal>
</goals>
</execution>
-
+
</executions>
</plugin>
<!--
Unfortunately we can't execute the same report twice, so
- we have to generate this files outside report generation.
+ we have to generate this files outside report generation.
-->
<plugin>
<groupId>net.sourceforge.maven-taglib</groupId>
<artifactId>maven-taglib-plugin</artifactId>
<version>2.4</version>
<executions>
-
+
<execution>
<id>tlddoc-facelets</id>
<phase>site</phase>
@@ -871,7 +871,7 @@
<tldDocDir>${basedir}/target/site/tlddoc-facelets</tldDocDir>
</configuration>
</execution>
-
+
<execution>
<id>tlddoc-jsp</id>
<phase>site</phase>
@@ -884,7 +884,7 @@
<tldDocDir>${basedir}/target/site/tlddoc</tldDocDir>
</configuration>
</execution>
-
+
</executions>
</plugin>
@@ -965,13 +965,13 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>net.sourceforge.maven-taglib</groupId>
<artifactId>maven-taglib-plugin</artifactId>
<version>2.4</version>
<executions>
-
+
<execution>
<id>tlddoc-facelets</id>
<!--
@@ -991,7 +991,7 @@
<tldDocDir>${basedir}/target/site/tlddoc-facelets</tldDocDir>
</configuration>
</execution>
-
+
<execution>
<id>tlddoc-jsp</id>
<phase>process-resources</phase>
@@ -1014,7 +1014,7 @@
<tldDocDir>${basedir}/target/site/tlddoc</tldDocDir>
</configuration>
</execution>
-
+
<execution>
<id>attach-tlddoc-facelets</id>
<goals>
@@ -1026,7 +1026,7 @@
<tlddocJar>${basedir}/target/${project.artifactId}-${project.version}-facelets-tlddoc.jar</tlddocJar>
</configuration>
</execution>
-
+
</executions>
</plugin>
@@ -1052,7 +1052,7 @@
</execution>
</executions>
</plugin>
-
+
</plugins>
</build>
</profile>
@@ -1105,7 +1105,7 @@
</profiles>
-
+
<dependencies>
<!-- NOTE that all versions and scopes are defined in the parent dependencyManagement section -->
@@ -1116,30 +1116,30 @@
</dependency>
<!-- this dependency will be packed together with the main artifact of this pom -->
- <!--
+ <!--
<dependency>
<groupId>org.apache.myfaces.shared</groupId>
<artifactId>myfaces-shared-impl</artifactId>
</dependency>
-->
-
+
<!-- This is included in myfaces-impl-shared, but in eclipse
it is not detected, so an easy workaround is include it
as an optional dependency -->
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared-public</artifactId>
- <optional>true</optional>
+ <optional>true</optional>
</dependency>
-
+
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared</artifactId>
- <optional>true</optional>
+ <optional>true</optional>
</dependency>
- <!-- Servlet 3.1 -->
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
@@ -1173,7 +1173,7 @@
<artifactId>geronimo-validation_1.0_spec</artifactId>
<optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
</dependency>
-
+
<!-- annotations 1.2 (javax.annotation.*) -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
@@ -1193,24 +1193,24 @@
<artifactId>geronimo-ejb_3.0_spec</artifactId>
<optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
</dependency>
-
+
<!-- CDI -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_1.1_spec</artifactId>
- </dependency>
+ </dependency>
<!-- builder-annotations like @JSFWebConfigParam -->
<dependency>
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-annotations</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
</dependency>
-
+
<!-- Websockets -->
<dependency>
<groupId>org.apache.tomcat</groupId>
@@ -1240,7 +1240,7 @@
<artifactId>guice</artifactId>
<optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
</dependency>
-
+
<!-- TEST DEPENDENCIES -->
@@ -1248,7 +1248,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@@ -1262,7 +1262,7 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
-
+
<dependency>
<groupId>org.apache.myfaces.test</groupId>
<artifactId>myfaces-test23</artifactId>
@@ -1341,20 +1341,20 @@
<version>${openwebbeans.version}</version>
<scope>test</scope>
</dependency>-->
-
+
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr303</artifactId>
<version>0.5</version>
<scope>test</scope>
</dependency>
-
+
</dependencies>
-
+
<reporting>
<plugins>
-
+
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
@@ -1378,20 +1378,20 @@
</reportSet>
</reportSets>
</plugin>
-
+
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
-
+
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
-
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
</plugin>
-
+
<!-- override PMD settings to set targetJdk -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
@@ -1418,7 +1418,7 @@
</reportSet>
</reportSets>
</plugin>
-
+
</plugins>
</reporting>
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java Fri Jan 5 13:41:34 2018
@@ -29,10 +29,12 @@ import java.net.URLEncoder;
import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.logging.Logger;
import javax.faces.FacesException;
@@ -57,6 +59,7 @@ import javax.servlet.http.HttpSession;
import org.apache.myfaces.shared.context.flash.FlashImpl;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
import org.apache.myfaces.util.EnumerationIterator;
+import org.apache.myfaces.util.ExternalSpecifications;
/**
* Implements the external context for servlet request. JSF 1.2, 6.1.3
@@ -73,6 +76,8 @@ public final class ServletExternalContex
private static final char URL_QUERY_SEPERATOR='?';
private static final char URL_FRAGMENT_SEPERATOR='#';
private static final String URL_NAME_VALUE_PAIR_SEPERATOR="=";
+ private static final String PUSHED_RESOURCE_URLS = "oam.PUSHED_RESOURCE_URLS";
+ private static final String PUSH_SUPPORTED = "oam.PUSH_SUPPORTED";
private ServletRequest _servletRequest;
private ServletResponse _servletResponse;
@@ -365,9 +370,65 @@ public final class ServletExternalContex
{
checkNull(url, "url");
checkHttpServletRequest();
- return ((HttpServletResponse) _servletResponse).encodeURL(url);
+ String encodedUrl = ((HttpServletResponse) _servletResponse).encodeURL(url);
+
+ pushResource(encodedUrl);
+
+ return encodedUrl;
}
+ protected void pushResource(String resourceUrl)
+ {
+ if (!ExternalSpecifications.isServlet4Available())
+ {
+ return;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Map<Object, Object> attributes = facesContext.getAttributes();
+
+ javax.servlet.http.PushBuilder pushBuilder = null;
+
+ if (!attributes.containsKey(PUSH_SUPPORTED))
+ {
+ Object request = getRequest();
+ boolean pushSupported = false;
+ if (request instanceof HttpServletRequest)
+ {
+ HttpServletRequest servletRequest = (HttpServletRequest) request;
+ pushBuilder = servletRequest.newPushBuilder();
+ pushSupported = pushBuilder != null;
+ }
+
+ attributes.put(PUSH_SUPPORTED, pushSupported);
+ }
+
+ boolean pushSupported = (boolean) attributes.get(PUSH_SUPPORTED);
+ if (!pushSupported)
+ {
+ return;
+ }
+
+ Set<String> pushedResourceUrls = (Set<String>) facesContext.getAttributes()
+ .computeIfAbsent(PUSHED_RESOURCE_URLS, a -> new HashSet<>());
+ if (pushedResourceUrls.contains(resourceUrl))
+ {
+ return;
+ }
+
+ // might be != null on the first hit
+ if (pushBuilder == null)
+ {
+ HttpServletRequest servletRequest = (HttpServletRequest) getRequest();
+ pushBuilder = servletRequest.newPushBuilder();
+ }
+
+ if (pushBuilder != null)
+ {
+ pushBuilder.path(resourceUrl).push();
+ }
+ }
+
@Override
public String encodeNamespace(final String s)
{
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java Fri Jan 5 13:41:34 2018
@@ -42,6 +42,7 @@ public final class ExternalSpecification
private static volatile Boolean beanValidationAvailable;
private static volatile Boolean cdiAvailable;
private static volatile Boolean el3Available;
+ private static volatile Boolean sevlet4Available;
/**
* This method determines if Bean Validation is present.
@@ -130,6 +131,23 @@ public final class ExternalSpecification
return el3Available;
}
+ public static boolean isServlet4Available()
+ {
+ if (sevlet4Available == null)
+ {
+ try
+ {
+ sevlet4Available = Class.forName("javax.servlet.http.PushBuilder") != null ;
+ }
+ catch (Throwable t)
+ {
+ sevlet4Available = false;
+ }
+ log.info("MyFaces Servlet 4.0 support " + (sevlet4Available ? "enabled" : "disabled"));
+ }
+ return sevlet4Available;
+ }
+
/**
* this class should not be instantiated.
*/
Modified: myfaces/core/branches/2.3.x/parent/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/parent/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/parent/pom.xml (original)
+++ myfaces/core/branches/2.3.x/parent/pom.xml Fri Jan 5 13:41:34 2018
@@ -35,7 +35,7 @@
</description>
<version>2.3.0-SNAPSHOT</version>
<url>http://myfaces.apache.org/core23</url>
-
+
<issueManagement>
<system>jira</system>
<url>https://issues.apache.org/jira/browse/MYFACES</url>
@@ -48,7 +48,7 @@
</scm>
<build>
-
+
<!-- Since Maven 3.0, this is required to add scpexe as protocol for deploy. -->
<extensions>
<extension>
@@ -57,7 +57,7 @@
<version>1.0-beta-7</version>
</extension>
</extensions>
-
+
<plugins>
<!-- JDK 1.8 -->
@@ -112,7 +112,7 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
@@ -132,7 +132,7 @@
<stagingSiteURL>${siteDeploy.url}</stagingSiteURL>
</configuration>
</plugin>
-
+
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
@@ -154,7 +154,7 @@
<artifactId>myfaces-builder-plugin</artifactId>
<version>1.0.10</version>
</plugin>
-
+
<plugin>
<artifactId>myfaces-javascript-plugin</artifactId>
<groupId>org.apache.myfaces.buildtools</groupId>
@@ -195,12 +195,12 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</plugin>
-
+
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
</plugin>
-
+
<!-- SITE GENERATION -->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -216,7 +216,7 @@
<placement>X</placement>
</tag>
</tags>
- </configuration>
+ </configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
@@ -258,7 +258,7 @@
</build>
-
+
<profiles>
<!-- TODO jakobk: we could change this to -Papache-release -->
@@ -342,7 +342,7 @@
</plugin>
</plugins>
</reporting>
-
+
<dependencyManagement>
@@ -373,7 +373,7 @@
<artifactId>myfaces-impl-shared-public</artifactId>
<version>${project.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared</artifactId>
@@ -383,11 +383,11 @@
<!-- SPEC DEPENDENCIES -->
- <!-- Servlet 3.1 -->
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
- <version>8.5.21</version>
+ <version>9.0.2</version>
<scope>provided</scope>
</dependency>
@@ -413,7 +413,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<!-- annotations 1.2 (javax.annotation.*) -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
@@ -468,7 +468,7 @@
<artifactId>geronimo-jcdi_1.1_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
- <!-- MYFACES-3917 set compile/optional, clashes
+ <!-- MYFACES-3917 set compile/optional, clashes
with weld cdi by transitive dependency effect
<scope>compile</scope>
<optional>true</optional>
@@ -490,7 +490,7 @@
<version>7.0.78</version>
<scope>provided</scope>
</dependency>
-
+
<!-- UTILITY DEPENDENCIES -->
<!-- builder-annotations like @JSFWebConfigParam -->
@@ -500,7 +500,7 @@
<version>1.0.9</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
@@ -544,7 +544,7 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
-
+
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@@ -645,7 +645,7 @@
</repository>
</repositories>
-
+
<!--
<distributionManagement>
<site>
Modified: myfaces/core/branches/2.3.x/shared-public/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared-public/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared-public/pom.xml (original)
+++ myfaces/core/branches/2.3.x/shared-public/pom.xml Fri Jan 5 13:41:34 2018
@@ -25,7 +25,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
-
+
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared-public</artifactId>
<packaging>jar</packaging>
@@ -38,7 +38,7 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/shared-public</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/myfaces/core/branches/2.3.x/shared-public</url>
</scm>
-
+
<dependencies>
<!-- myfaces-api -->
<dependency>
@@ -46,7 +46,7 @@
<artifactId>myfaces-api</artifactId>
</dependency>
- <!-- Servlet 3.1 -->
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
@@ -57,13 +57,13 @@
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jsp_2.2_spec</artifactId>
</dependency>
-
+
<!-- el 2.2 (javax.el.*) -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-el_2.2_spec</artifactId>
</dependency>
-
+
<!-- builder-annotations like @JSFWebConfigParam -->
<dependency>
<groupId>org.apache.myfaces.buildtools</groupId>
@@ -74,7 +74,7 @@
<groupId>org.apache.myfaces.test</groupId>
<artifactId>myfaces-test23</artifactId>
</dependency>
-
+
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@@ -91,7 +91,7 @@
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
</dependency>
-
+
</dependencies>
<build>
@@ -156,7 +156,7 @@
</reportSet>
</reportSets>
</plugin>
- <!--
+ <!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>surefire-report-maven-plugin</artifactId>
Modified: myfaces/core/branches/2.3.x/shared/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/pom.xml?rev=1820295&r1=1820294&r2=1820295&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/pom.xml (original)
+++ myfaces/core/branches/2.3.x/shared/pom.xml Fri Jan 5 13:41:34 2018
@@ -25,7 +25,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
-
+
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared</artifactId>
<packaging>jar</packaging>
@@ -38,21 +38,21 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.3.x/shared</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/myfaces/core/branches/2.3.x/shared</url>
</scm>
-
+
<dependencies>
<!-- myfaces-api -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.myfaces.core.internal</groupId>
<artifactId>myfaces-impl-shared-public</artifactId>
<optional>true</optional>
</dependency>
- <!-- Servlet 3.1 -->
+ <!-- Servlet 4.0 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
@@ -63,13 +63,13 @@
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jsp_2.2_spec</artifactId>
</dependency>
-
+
<!-- el 2.2 (javax.el.*) -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-el_2.2_spec</artifactId>
</dependency>
-
+
<!-- builder-annotations like @JSFWebConfigParam -->
<dependency>
<groupId>org.apache.myfaces.buildtools</groupId>
@@ -80,7 +80,7 @@
<groupId>org.apache.myfaces.test</groupId>
<artifactId>myfaces-test23</artifactId>
</dependency>
-
+
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@@ -97,7 +97,7 @@
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
</dependency>
-
+
</dependencies>
<build>
@@ -165,7 +165,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
<plugin>
<artifactId>myfaces-javascript-plugin</artifactId>
<groupId>org.apache.myfaces.buildtools</groupId>
@@ -215,7 +215,7 @@
<outputDirectory>${project.build.directory}/generated-resources/myfaces-javascript-plugin/META-INF/resources/org.apache.myfaces/</outputDirectory>
</configuration>
</plugin>
-
+
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -272,7 +272,7 @@
</reportSet>
</reportSets>
</plugin>
- <!--
+ <!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>surefire-report-maven-plugin</artifactId>