Permalink
Browse files

http://java.net/jira/browse/JAVASERVERFACES-3787 https://java.net/jir…

…a/browse/JAVASERVERFACES_SPEC_PUBLIC-936

SECTION: Modified Files
----------------------------
M       jsf-api/src/main/java/javax/faces/application/ViewHandler.java

- change spec for REFRESH_PERIOD to add

+     * <span class="changed_added_2_3">If {@link javax.faces.application.ProjectStage} 
+     * is set to {@code Production} and this value is not otherwise specified, 
+     * the runtime must act as if it is set to -1.</span>


M       jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java

- implement the change

M       test/servlet40/pom.xml
A       test/servlet40/productionRefreshPeriod
A       test/servlet40/productionRefreshPeriod/src
A       test/servlet40/productionRefreshPeriod/src/main
A       test/servlet40/productionRefreshPeriod/src/main/webapp
A       test/servlet40/productionRefreshPeriod/src/main/webapp/index.xhtml
A       test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF
A       test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/faces-config.xml
A       test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/beans.xml
A       test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/web.xml
A       test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/glassfish-web.xml
A       test/servlet40/productionRefreshPeriod/src/main/java
A       test/servlet40/productionRefreshPeriod/src/main/java/com
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun/faces
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun/faces/test
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun/faces/test/servlet40
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/productionRefreshPeriod
A       test/servlet40/productionRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/productionRefreshPeriod/UserBean.java
A       test/servlet40/productionRefreshPeriod/src/main/resources
A       test/servlet40/productionRefreshPeriod/src/test
A       test/servlet40/productionRefreshPeriod/src/test/java
A       test/servlet40/productionRefreshPeriod/src/test/java/com
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun/faces
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun/faces/test
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun/faces/test/servlet40
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun/faces/test/servlet40/productionRefreshPeriod
A       test/servlet40/productionRefreshPeriod/src/test/java/com/sun/faces/test/servlet40/productionRefreshPeriod/Isuse3787IT.java
A       test/servlet40/productionRefreshPeriod/pom.xml
A       test/servlet40/explicitRefreshPeriod
A       test/servlet40/explicitRefreshPeriod/nbactions.xml
A       test/servlet40/explicitRefreshPeriod/src
A       test/servlet40/explicitRefreshPeriod/src/test
A       test/servlet40/explicitRefreshPeriod/src/test/java
A       test/servlet40/explicitRefreshPeriod/src/test/java/com
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun/faces
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun/faces/test
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun/faces/test/servlet40
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun/faces/test/servlet40/explicitRefreshPeriod
A       test/servlet40/explicitRefreshPeriod/src/test/java/com/sun/faces/test/servlet40/explicitRefreshPeriod/Isuse3787IT.java
A       test/servlet40/explicitRefreshPeriod/src/main
A       test/servlet40/explicitRefreshPeriod/src/main/resources
A       test/servlet40/explicitRefreshPeriod/src/main/webapp
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/index.xhtml
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/beans.xml
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/web.xml
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/glassfish-web.xml
A       test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/faces-config.xml
A       test/servlet40/explicitRefreshPeriod/src/main/java
A       test/servlet40/explicitRefreshPeriod/src/main/java/com
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun/faces
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun/faces/test
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun/faces/test/servlet40
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/explicitRefreshPeriod
A       test/servlet40/explicitRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/explicitRefreshPeriod/UserBean.java
A       test/servlet40/explicitRefreshPeriod/pom.xml

- Test content



git-svn-id: https://svn.java.net/svn/mojarra~svn/trunk@14434 761efcf2-d34d-6b61-9145-99dcacc3edf1
  • Loading branch information...
1 parent 52d9b3c commit 077f851e5acd524b5803d4101568e7cf2bc1f0f8 edburns committed Feb 24, 2015
Showing with 732 additions and 10 deletions.
  1. +6 −2 jsf-api/src/main/java/javax/faces/application/ViewHandler.java
  2. +10 −1 jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
  3. +60 −0 test/servlet40/explicitRefreshPeriod/pom.xml
  4. +37 −0 ...licitRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/explicitRefreshPeriod/UserBean.java
  5. +9 −0 test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/beans.xml
  6. +7 −0 test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/faces-config.xml
  7. +11 −0 test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/glassfish-web.xml
  8. +74 −0 test/servlet40/explicitRefreshPeriod/src/main/webapp/WEB-INF/web.xml
  9. +56 −0 test/servlet40/explicitRefreshPeriod/src/main/webapp/index.xhtml
  10. +103 −0 ...itRefreshPeriod/src/test/java/com/sun/faces/test/servlet40/explicitRefreshPeriod/Isuse3787IT.java
  11. +5 −7 test/servlet40/pom.xml
  12. +60 −0 test/servlet40/productionRefreshPeriod/pom.xml
  13. +37 −0 ...ionRefreshPeriod/src/main/java/com/sun/faces/test/servlet40/productionRefreshPeriod/UserBean.java
  14. +9 −0 test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/beans.xml
  15. +7 −0 test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/faces-config.xml
  16. +11 −0 test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/glassfish-web.xml
  17. +71 −0 test/servlet40/productionRefreshPeriod/src/main/webapp/WEB-INF/web.xml
  18. +56 −0 test/servlet40/productionRefreshPeriod/src/main/webapp/index.xhtml
  19. +103 −0 ...RefreshPeriod/src/test/java/com/sun/faces/test/servlet40/productionRefreshPeriod/Isuse3787IT.java
@@ -61,7 +61,7 @@
/**
* <p><strong><span
- * class="changed_modified_2_0 changed_modified_2_1 changed_modified_2_2">
+ * class="changed_modified_2_0 changed_modified_2_1 changed_modified_2_2 changed_modified_2_3">
* ViewHandler</span></strong> is the
* pluggablity mechanism for allowing implementations of or applications
* using the JavaServer Faces specification to provide their own
@@ -203,13 +203,17 @@
"javax.faces.FACELETS_BUFFER_SIZE";
/**
- * <p class="changed_added_2_2">When a page is requested, what interval in seconds should the compiler
+ * <p class="changed_added_2_2"><span class="changed_modified_2_3">When</span>
+ * a page is requested, what interval in seconds should the compiler
* check for changes. If you don't want the compiler to check for changes
* once the page is compiled, then use a value of -1. Setting a low
* refresh period helps during development to be able to edit pages in a
* running application.The runtime must also consider the
* facelets.REFRESH_PERIOD param name as an alias to this param name for
* backwards compatibility with existing facelets tag libraries.
+ * <span class="changed_added_2_3">If {@link javax.faces.application.ProjectStage}
+ * is set to {@code Production} and this value is not otherwise specified,
+ * the runtime must act as if it is set to -1.</span>
* </p>
*
* @since 2.0
@@ -812,7 +812,16 @@ protected DefaultFaceletFactory createFaceletFactory(FacesContext ctx,
Compiler c, WebConfiguration webConfig) {
// refresh period
- String refreshPeriod = webConfig.getOptionValue(FaceletsDefaultRefreshPeriod);
+ boolean isProduction = app.getProjectStage() == ProjectStage.Production;
+ String refreshPeriod;
+ if (webConfig.isSet(FaceletsDefaultRefreshPeriod) || webConfig.isSet(FaceletsDefaultRefreshPeriodDeprecated)) {
+ refreshPeriod = webConfig.getOptionValue(FaceletsDefaultRefreshPeriod);
+ } else if (isProduction) {
+ refreshPeriod = "-1";
+ } else {
+ refreshPeriod = FaceletsDefaultRefreshPeriod.getDefaultValue();
+ }
+
long period = Long.parseLong(refreshPeriod);
// resource resolver
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+--><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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>pom</artifactId>
+ <groupId>com.sun.faces.test.servlet40</groupId>
+ <version>2.3.0-m02-SNAPSHOT</version>
+ </parent>
+
+ <groupId>com.sun.face.test.servlet40</groupId>
+ <artifactId>explicitRefreshPeriod</artifactId>
+ <packaging>war</packaging>
+ <name>Mojarra ${project.version} - Test - Servlet 4.0 - ProjectStage Explicit RefreshPeriod</name>
+
+ <build>
+ <finalName>test-servlet40-explicitRefreshPeriod</finalName>
+ </build>
+
+
+</project>
@@ -0,0 +1,37 @@
+package com.sun.faces.test.servlet40.explicitRefreshPeriod;
+
+import com.sun.faces.application.ApplicationAssociate;
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.context.ExternalContext;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+public class UserBean implements Serializable {
+
+ protected String firstName;
+ @Inject
+ ExternalContext extContext;
+
+ public UserBean() {
+ }
+
+ @PostConstruct
+ private void init() {
+ ApplicationAssociate appAss = ApplicationAssociate.getInstance(extContext);
+ firstName = "" + appAss.getFaceletFactory().getRefreshPeriod();
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+}
+
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file can be an empty text file (0 bytes) -->
+<!-- We're declaring the schema to save you time if you do have to configure
+ this in the future -->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config version="2.3"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">
+
+</faces-config>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
+<glassfish-web-app error-url="">
+ <context-root>/test-servlet40-explicitRefreshPeriod</context-root>
+ <class-loader delegate="true"/>
+ <jsp-config>
+ <property name="keepgenerated" value="true">
+ <description>Keep a copy of the generated servlet class' java code.</description>
+ </property>
+ </jsp-config>
+</glassfish-web-app>
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+-->
+
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>${webapp.projectStage}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
+ <param-value>${webapp.partialStateSaving}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>${webapp.stateSavingMethod}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
+ <param-value>30</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>faces/index.xhtml</welcome-file>
+ </welcome-file-list>
+</web-app>
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+-->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <h:form prependId="false">
+ <h:inputText value="#{userBean.firstName}" />
+ <h:commandButton value="submit" />
+ </h:form>
+ </body>
+</html>
+
Oops, something went wrong.

0 comments on commit 077f851

Please sign in to comment.