Skip to content

Commit

Permalink
SAK-29126 Add a property to control JSF State in sakai.properties (sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjmerono authored and jonespm committed Dec 3, 2016
1 parent b9e8d38 commit 2fc3479
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<display-name>summary-calendar</display-name>
<description>Summary Calendar Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<!-- Changed ordering to meet DTD - PAFH 8/24/2006 -->
<description>
Expand Down
4 changes: 0 additions & 4 deletions chat/chat-tool/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
</listener>

<!-- the faces handling xml -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,14 @@
# DEFAULT: none (null) - code only responds if this is set to "websphere"
# servlet.container=websphere

# JSF Saving State Method
# By default Sakai is using "client" as SAVING_STATE_METHOD in JSF tools
# You can change this value to "server" in all jsf tools with default or in selected ones
# jsf.state_saving_method=server
# jsf.state_saving_method.{servlet-name}=server
# Example: jsf.state_saving_method.sakai.samigo=server
# Example: jsf.state_saving_method.sakai.summary.calendar=server


# ########################################################################
# EMAIL
Expand Down
4 changes: 0 additions & 4 deletions gradebook/app/sakai-tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>sakai-gradebook-tool</display-name>
<description>Sakai Gradebook Tool Integration</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<!-- the following context-param allows the gradebook to generate a random secret for
MyFaces ViewState encryption. The encryption algorithm can be customized by
Expand Down
5 changes: 0 additions & 5 deletions help/help-tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<display-name>sakai-help</display-name>
<description>Sakai Help Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
Expand Down
5 changes: 0 additions & 5 deletions jobscheduler/scheduler-tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<display-name>sakai-scheduler</display-name>
<description>Scheduler Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
Expand Down
8 changes: 7 additions & 1 deletion jsf/jsf-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-kernel-util</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-component-manager</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
Expand Down
15 changes: 13 additions & 2 deletions jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -36,6 +37,8 @@
import org.sakaiproject.tool.cover.SessionManager;
import org.sakaiproject.tool.api.Tool;
import org.sakaiproject.util.Web;
import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.component.api.ServerConfigurationService;

/**
* <p>
Expand Down Expand Up @@ -277,7 +280,15 @@ public String getServletInfo()
public void init(ServletConfig config) throws ServletException
{
super.init(config);

ServerConfigurationService scs = ComponentManager.get(ServerConfigurationService.class);
ServletContext context = config.getServletContext();
String customJsfState = scs.getString("jsf.state_saving_method."+config.getServletName(), null);
String defaultJsfState = scs.getString("jsf.state_saving_method", "client");
if (customJsfState != null) {
context.setInitParameter("javax.faces.STATE_SAVING_METHOD", customJsfState);
} else if (defaultJsfState != null) {
context.setInitParameter("javax.faces.STATE_SAVING_METHOD", defaultJsfState);
}
m_default = config.getInitParameter("default");
m_path = config.getInitParameter("path");
m_defaultToLastView = "true".equals(config.getInitParameter("default.last.view"));
Expand All @@ -288,7 +299,7 @@ public void init(ServletConfig config) throws ServletException
m_path = m_path.substring(0, m_path.length() - 1);
}

M_log.info("init: default: " + m_default + " path: " + m_path);
M_log.info("init: "+config.getServletName()+"["+context.getInitParameter("javax.faces.STATE_SAVING_METHOD")+"]"+" default: " + m_default + " path: " + m_path);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions msgcntr/messageforums-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

<display-name>messageforums</display-name>
<description>Sakai Message Forums</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<!-- Changed ordering - PAFH 8/24/2006 -->
<description> Set this flag to true if you want the JavaServer
Expand Down
5 changes: 0 additions & 5 deletions podcasts/podcasts-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>sakai-podcasts</display-name>
<description>Sakai Podcasts Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/local.xml</param-value>
Expand Down
5 changes: 0 additions & 5 deletions postem/postem-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>sakai-postem</display-name>
<description>Sakai Postem Gradebook Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<!--sakai-->
<!-- <context-param>
<param-name>com.sun.faces.validateXml</param-name>
Expand Down
5 changes: 0 additions & 5 deletions samigo/samigo-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@


<!-- BEGIN SAMIGO JSF CONTEXT PARAM-->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<description>
Set this flag to true if you want the JavaServer Faces
Expand Down
4 changes: 0 additions & 4 deletions sections/sections-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-application.xml,/WEB-INF/faces-beans.xml,/WEB-INF/faces-navigation.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
Expand Down
5 changes: 0 additions & 5 deletions signup/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
<display-name>sakai-signup</display-name>
<description>Sakai Sign-up</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>false</param-value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<display-name>sakai-siteassociation</display-name>
<description>Site Association Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
Expand Down
5 changes: 0 additions & 5 deletions syllabus/syllabus-app/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<display-name>sakai-syllabus</display-name>
<description>Sakai Syllabus Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<!--sakai-->
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
Expand Down
5 changes: 0 additions & 5 deletions tool/tool-tool/su/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>tool-tool-su</display-name>
<description>tool-tool-su</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>sakai-user-tool-admin-prefs</display-name>
<description>sakai-user-tool-admin-prefs</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<!-- Ordering changed to meet DTD - PAFH 8/30/2006 -->
<description>
Expand Down
5 changes: 0 additions & 5 deletions user/user-tool-prefs/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>sakai-user-tool-prefs</display-name>
<description>sakai-user-tool-prefs</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<!-- Ordering changed to meet DTD - PAFH 8/30/2006 -->
<description>
Expand Down
5 changes: 0 additions & 5 deletions userauditservice/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<display-name>sakai-useraudit</display-name>
<description>Site User Audit Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
Expand Down
5 changes: 0 additions & 5 deletions usermembership/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<display-name>usermembership</display-name>
<description>User Membership Tool</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<context-param>
<description>
Set this flag to true if you want the JavaServer Faces
Expand Down

0 comments on commit 2fc3479

Please sign in to comment.