Skip to content

Commit 2fc3479

Browse files
juanjmeronojonespm
authored andcommitted
SAK-29126 Add a property to control JSF State in sakai.properties (sakaiproject#3559)
1 parent b9e8d38 commit 2fc3479

File tree

21 files changed

+28
-89
lines changed
  • calendar/calendar-summary-tool/tool/src/webapp/WEB-INF
  • chat/chat-tool/tool/src/webapp/WEB-INF
  • config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle
  • gradebook/app/sakai-tool/src/webapp/WEB-INF
  • help/help-tool/src/webapp/WEB-INF
  • jobscheduler/scheduler-tool/src/webapp/WEB-INF
  • jsf/jsf-tool
  • msgcntr/messageforums-app/src/webapp/WEB-INF
  • podcasts/podcasts-app/src/webapp/WEB-INF
  • postem/postem-app/src/webapp/WEB-INF
  • samigo/samigo-app/src/webapp/WEB-INF
  • sections/sections-app/src/webapp/WEB-INF
  • signup/tool/src/webapp/WEB-INF
  • site-manage/site-association-tool/tool/src/webapp/WEB-INF
  • syllabus/syllabus-app/src/webapp/WEB-INF
  • tool/tool-tool/su/src/webapp/WEB-INF
  • user
    • user-tool-admin-prefs/admin-prefs/src/webapp/WEB-INF
    • user-tool-prefs/tool/src/webapp/WEB-INF
  • userauditservice/tool/src/webapp/WEB-INF
  • usermembership/tool/src/webapp/WEB-INF

21 files changed

+28
-89
lines changed

calendar/calendar-summary-tool/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
<display-name>summary-calendar</display-name>
77
<description>Summary Calendar Tool</description>
88

9-
<context-param>
10-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
11-
<param-value>client</param-value>
12-
</context-param>
13-
149
<context-param>
1510
<!-- Changed ordering to meet DTD - PAFH 8/24/2006 -->
1611
<description>

chat/chat-tool/tool/src/webapp/WEB-INF/web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@
6666
</listener>
6767

6868
<!-- the faces handling xml -->
69-
<context-param>
70-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
71-
<param-value>client</param-value>
72-
</context-param>
7369
<context-param>
7470
<param-name>com.sun.faces.validateXml</param-name>
7571
<param-value>true</param-value>

config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/default.sakai.properties

+8
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,14 @@
13221322
# DEFAULT: none (null) - code only responds if this is set to "websphere"
13231323
# servlet.container=websphere
13241324

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

13261334
# ########################################################################
13271335
# EMAIL

gradebook/app/sakai-tool/src/webapp/WEB-INF/web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
55
<display-name>sakai-gradebook-tool</display-name>
66
<description>Sakai Gradebook Tool Integration</description>
7-
<context-param>
8-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
9-
<param-value>client</param-value>
10-
</context-param>
117

128
<!-- the following context-param allows the gradebook to generate a random secret for
139
MyFaces ViewState encryption. The encryption algorithm can be customized by

help/help-tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
<display-name>sakai-help</display-name>
77
<description>Sakai Help Tool</description>
88

9-
<context-param>
10-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
11-
<param-value>client</param-value>
12-
</context-param>
13-
149
<context-param>
1510
<param-name>com.sun.faces.validateXml</param-name>
1611
<param-value>true</param-value>

jobscheduler/scheduler-tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
<display-name>sakai-scheduler</display-name>
77
<description>Scheduler Tool</description>
88

9-
<context-param>
10-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
11-
<param-value>client</param-value>
12-
</context-param>
13-
149
<context-param>
1510
<param-name>com.sun.faces.validateXml</param-name>
1611
<param-value>true</param-value>

jsf/jsf-tool/pom.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@
2323
<groupId>org.sakaiproject.kernel</groupId>
2424
<artifactId>sakai-kernel-util</artifactId>
2525
</dependency>
26+
<dependency>
27+
<groupId>org.sakaiproject.kernel</groupId>
28+
<artifactId>sakai-component-manager</artifactId>
29+
</dependency>
2630
<dependency>
2731
<groupId>javax.servlet</groupId>
28-
<artifactId>servlet-api</artifactId>
32+
<artifactId>javax.servlet-api</artifactId>
33+
<version>3.1.0</version>
34+
<scope>provided</scope>
2935
</dependency>
3036
<dependency>
3137
<groupId>org.sakaiproject.kernel</groupId>

jsf/jsf-tool/src/java/org/sakaiproject/jsf/util/JsfTool.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import javax.servlet.RequestDispatcher;
2727
import javax.servlet.ServletConfig;
28+
import javax.servlet.ServletContext;
2829
import javax.servlet.ServletException;
2930
import javax.servlet.http.HttpServlet;
3031
import javax.servlet.http.HttpServletRequest;
@@ -36,6 +37,8 @@
3637
import org.sakaiproject.tool.cover.SessionManager;
3738
import org.sakaiproject.tool.api.Tool;
3839
import org.sakaiproject.util.Web;
40+
import org.sakaiproject.component.cover.ComponentManager;
41+
import org.sakaiproject.component.api.ServerConfigurationService;
3942

4043
/**
4144
* <p>
@@ -277,7 +280,15 @@ public String getServletInfo()
277280
public void init(ServletConfig config) throws ServletException
278281
{
279282
super.init(config);
280-
283+
ServerConfigurationService scs = ComponentManager.get(ServerConfigurationService.class);
284+
ServletContext context = config.getServletContext();
285+
String customJsfState = scs.getString("jsf.state_saving_method."+config.getServletName(), null);
286+
String defaultJsfState = scs.getString("jsf.state_saving_method", "client");
287+
if (customJsfState != null) {
288+
context.setInitParameter("javax.faces.STATE_SAVING_METHOD", customJsfState);
289+
} else if (defaultJsfState != null) {
290+
context.setInitParameter("javax.faces.STATE_SAVING_METHOD", defaultJsfState);
291+
}
281292
m_default = config.getInitParameter("default");
282293
m_path = config.getInitParameter("path");
283294
m_defaultToLastView = "true".equals(config.getInitParameter("default.last.view"));
@@ -288,7 +299,7 @@ public void init(ServletConfig config) throws ServletException
288299
m_path = m_path.substring(0, m_path.length() - 1);
289300
}
290301

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

294305
/**

msgcntr/messageforums-app/src/webapp/WEB-INF/web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77

88
<display-name>messageforums</display-name>
99
<description>Sakai Message Forums</description>
10-
<context-param>
11-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
12-
<param-value>client</param-value>
13-
</context-param>
1410
<context-param>
1511
<!-- Changed ordering - PAFH 8/24/2006 -->
1612
<description> Set this flag to true if you want the JavaServer

podcasts/podcasts-app/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>sakai-podcasts</display-name>
66
<description>Sakai Podcasts Tool</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<context-param>
149
<param-name>contextConfigLocation</param-name>
1510
<param-value>/WEB-INF/local.xml</param-value>

postem/postem-app/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>sakai-postem</display-name>
66
<description>Sakai Postem Gradebook Tool</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<!--sakai-->
149
<!-- <context-param>
1510
<param-name>com.sun.faces.validateXml</param-name>

samigo/samigo-app/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010

1111
<!-- BEGIN SAMIGO JSF CONTEXT PARAM-->
12-
<context-param>
13-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
14-
<param-value>client</param-value>
15-
</context-param>
16-
1712
<context-param>
1813
<description>
1914
Set this flag to true if you want the JavaServer Faces

sections/sections-app/src/webapp/WEB-INF/web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<param-name>javax.faces.CONFIG_FILES</param-name>
1010
<param-value>/WEB-INF/faces-application.xml,/WEB-INF/faces-beans.xml,/WEB-INF/faces-navigation.xml</param-value>
1111
</context-param>
12-
<context-param>
13-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
14-
<param-value>client</param-value>
15-
</context-param>
1612
<context-param>
1713
<param-name>contextConfigLocation</param-name>
1814
<param-value>

signup/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
<display-name>sakai-signup</display-name>
1313
<description>Sakai Sign-up</description>
1414

15-
<context-param>
16-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
17-
<param-value>client</param-value>
18-
</context-param>
19-
2015
<context-param>
2116
<param-name>com.sun.faces.validateXml</param-name>
2217
<param-value>false</param-value>

site-manage/site-association-tool/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
<display-name>sakai-siteassociation</display-name>
99
<description>Site Association Tool</description>
1010

11-
<context-param>
12-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
13-
<param-value>client</param-value>
14-
</context-param>
15-
1611
<context-param>
1712
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
1813
<param-value>false</param-value>

syllabus/syllabus-app/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
<display-name>sakai-syllabus</display-name>
77
<description>Sakai Syllabus Tool</description>
88

9-
<context-param>
10-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
11-
<param-value>client</param-value>
12-
</context-param>
13-
149
<!--sakai-->
1510
<context-param>
1611
<param-name>com.sun.faces.validateXml</param-name>

tool/tool-tool/su/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>tool-tool-su</display-name>
66
<description>tool-tool-su</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<context-param>
149
<param-name>com.sun.faces.validateXml</param-name>
1510
<param-value>true</param-value>

user/user-tool-admin-prefs/admin-prefs/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>sakai-user-tool-admin-prefs</display-name>
66
<description>sakai-user-tool-admin-prefs</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<context-param>
149
<!-- Ordering changed to meet DTD - PAFH 8/30/2006 -->
1510
<description>

user/user-tool-prefs/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>sakai-user-tool-prefs</display-name>
66
<description>sakai-user-tool-prefs</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<context-param>
149
<!-- Ordering changed to meet DTD - PAFH 8/30/2006 -->
1510
<description>

userauditservice/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
<display-name>sakai-useraudit</display-name>
99
<description>Site User Audit Tool</description>
1010

11-
<context-param>
12-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
13-
<param-value>client</param-value>
14-
</context-param>
15-
1611
<context-param>
1712
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
1813
<param-value>false</param-value>

usermembership/tool/src/webapp/WEB-INF/web.xml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<display-name>usermembership</display-name>
66
<description>User Membership Tool</description>
77

8-
<context-param>
9-
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
10-
<param-value>client</param-value>
11-
</context-param>
12-
138
<context-param>
149
<description>
1510
Set this flag to true if you want the JavaServer Faces

0 commit comments

Comments
 (0)