The aim of the change bundle is to provide:
- a central location for all web.xml configuration information
- bring a consistent naming scheme (camel hump) for RI
web configuration parameters
* introduce a deprecation facility to continue to
support any deprecated parameters with a log message
stating such
- inital work to allow the modification of these parameters
at runtime
SECTION: Modified Files
----------------------------
M src/com/sun/faces/LogStrings.properties
- new log messages for reporting the web
configuration at startup
M src/com/sun/faces/RIConstants.java
M src/com/sun/faces/application/StateManagerImpl.java
M src/com/sun/faces/config/ConfigureListener.java
M src/com/sun/faces/config/GlassFishConfigureListener.java
M src/com/sun/faces/renderkit/ByteArrayGuard.java
M src/com/sun/faces/renderkit/RenderKitImpl.java
M src/com/sun/faces/renderkit/ResponseStateManagerImpl.java
M
systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java
- leverage the WebConfiguration class
- ByteArrayGuard is no longer a singleton. A new instance is created
per webapp and cached in ResponseStateManagerImpl
M test/com/sun/faces/config/ConfigFileTestCase.java
- slight update to take changes into account
A src/com/sun/faces/config/WebConfiguration.java
- single source for web configuration information
The aim of the changebundle is to provide:
- a central location for all web.xml configuration information
- bring a consistent naming scheme (camel hump) for RI
web configuration parameters
* introduce a deprecation facility to continue to
support any deprecated parameters with a log message
stating such
- inital work to allow the modification of these parameters
at runtime
SECTION: Modified Files
----------------------------
M src/com/sun/faces/LogStrings.properties
- new log messages for reporting the web
configuration at startup
M src/com/sun/faces/RIConstants.java
M src/com/sun/faces/application/StateManagerImpl.java
M src/com/sun/faces/config/ConfigureListener.java
M src/com/sun/faces/config/GlassFishConfigureListener.java
M src/com/sun/faces/renderkit/ByteArrayGuard.java
M src/com/sun/faces/renderkit/RenderKitImpl.java
M src/com/sun/faces/renderkit/ResponseStateManagerImpl.java
M systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java
- leverage the WebConfiguration class
- ByteArrayGuard is no longer a singleton. A new instance is created
per webapp and cached in ResponseStateManagerImpl
M test/com/sun/faces/config/ConfigFileTestCase.java
- slight update to take changes into account
A src/com/sun/faces/config/WebConfiguration.java
- single source for web configuration information
SECTION: Diffs
----------------------------
Index: src/com/sun/faces/LogStrings.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/LogStrings.properties,v
retrieving revision 1.11
diff -u -r1.11 LogStrings.properties
--- src/com/sun/faces/LogStrings.properties 14 Mar 2006 22:36:58 -0000 1.11
+++ src/com/sun/faces/LogStrings.properties 4 Apr 2006 17:31:59 -0000
@@ -41,5 +41,17 @@
jsf.util_no_annotation_processed=JSF1014: Unable to load annotation class ''{0}''. As a result, this annotation will not be processed.
jsf.config.listener.version=Initializing Sun''s JavaServer Faces implementation (|version.string|) for context ''{0}''
jsf.config.listener.version.complete=Completed initializing Sun''s JavaServer Faces implementation (|version.string|) for context ''{0}''
-jsf.config.listener.predestroy.error=''{0}'' was thrown while handling the PreDestroy annotation(s) for bean ''{1}'' in scope ''{2}''. Message: {3}
+jsf.config.listener.predestroy.error=JSF1017: ''{0}'' was thrown while handling the PreDestroy annotation(s) for bean ''{1}'' in scope ''{2}''. Message: {3}
jsf.viewhandler.requestpath.recursion=JSF1015: Request path ''{0}'' begins with one or more occurrences of the FacesServlet prefix path mapping ''{1}''.
+
+jsf.config.webconfig.configinfo=JSF1018: [{0}] Configuration option ''{1}'' set to ''{2}''
+jsf.config.webconfig.configinfo.reset=JSF1019: [{0}] Configuration option ''{1}'' RESET to ''{2}''
+jsf.config.webconfig.configinfo.reset.enabled=JSF1020: [{0}] Configuration option ''{1}}'' RESET to ENABLED
+jsf.config.webconfig.configinfo.reset.disabled=JSF1020: [{0}] Configuration option ''{1}}'' RESET to DISABLED
+jsf.config.webconfig.boolconfiginfo.enabled=JSF1021: [{0}] Configuration option ''{1}'' - ENABLED
+jsf.config.webconfig.boolconfiginfo.disabled=JSF1021: [{0}] Configuration option ''{1}'' - DISABLED
+jsf.config.webconfig.boolconfig.invalidvalue=JSF1022: [{0}] Invalid value ''{1}'' for configuration option ''{2}''. Valid values are ''{3}''. Falling back to the default of ''{4}''.
+jsf.config.webconfig.enventryinfo=JSF1023: [{0}] Envirnoment entry ''{1}'' processed, value ''{2}''
+jsf.config.webconfig.enventry.clientencrypt=JSF1024: [{0}] Client state encyrption: ENABLED
+jsf.config.webconfig.param.deprecated=JSF1025: [{0}] Context initialization parameter ''{1}'' is deprecated. The option will still be configured, but please use ''{2}'' in the future.
+jsf.config.webconfig.option.notconfigured=JSF1026: [{0}] Configuration option ''{1}'' not configured
Index: src/com/sun/faces/RIConstants.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/RIConstants.java,v
retrieving revision 1.81
diff -u -r1.81 RIConstants.java
--- src/com/sun/faces/RIConstants.java 29 Mar 2006 23:03:41 -0000 1.81
+++ src/com/sun/faces/RIConstants.java 4 Apr 2006 17:31:59 -0000
@@ -75,10 +75,7 @@
public static final String ACTUAL_VIEW_MAP = FACES_PREFIX +
"actualViewMap";
- public static final String SAVED_STATE = FACES_PREFIX + "savedState";
-
- public static final String CLIENT_STATE_ENC_PASSWORD_ENTRY_NAME =
- "java:comp/env/" + FACES_PREFIX + "ClientStateSavingPassword";
+ public static final String SAVED_STATE = FACES_PREFIX + "savedState";
/**
@@ -108,10 +105,7 @@
FACES_PREFIX + "IMMUTABLE";
public static final String ONE_TIME_INITIALIZATION_ATTR =
- FACES_PREFIX + "OneTimeInitialization";
-
- public static final String PREFER_XHTML =
- FACES_PREFIX + "PreferXHTML";
+ FACES_PREFIX + "OneTimeInitialization";
public static final String CONTENT_TYPE_IS_XHTML =
FACES_PREFIX + "ContentTypeIsXHTML";
Index: src/com/sun/faces/application/StateManagerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/StateManagerImpl.java,v
retrieving revision 1.45
diff -u -r1.45 StateManagerImpl.java
--- src/com/sun/faces/application/StateManagerImpl.java 29 Mar 2006 23:03:42 -0000 1.45
+++ src/com/sun/faces/application/StateManagerImpl.java 4 Apr 2006 17:32:00 -0000
@@ -49,6 +49,8 @@
import java.util.logging.Logger;
import com.sun.faces.RIConstants;
+import com.sun.faces.config.WebConfiguration;
+import com.sun.faces.config.WebConfiguration.WebContextInitParameter;
import com.sun.faces.renderkit.RenderKitUtils;
import com.sun.faces.util.LRUMap;
import com.sun.faces.util.MessageUtils;
@@ -67,17 +69,7 @@
// Log instance for this class
private static final Logger LOGGER =
- Util.getLogger(Util.FACES_LOGGER + Util.APPLICATION_LOGGER);
-
- private static final String NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION =
- RIConstants.FACES_PREFIX
- + "NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION";
-
- private static final String NUMBER_OF_VIEWS_IN_SESSION =
- RIConstants.FACES_PREFIX + "NUMBER_OF_VIEWS_IN_SESSION";
- private static final int DEFAULT_NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION =
- 15;
- private static final int DEFAULT_NUMBER_OF_VIEWS_IN_SESSION = 15;
+ Util.getLogger(Util.FACES_LOGGER + Util.APPLICATION_LOGGER);
/**
* Keyed by renderKitId, this Map contains a boolean that
@@ -507,25 +499,30 @@
if (noOfViewsInLogicalView != 0) {
return noOfViewsInLogicalView;
}
- noOfViewsInLogicalView =
- DEFAULT_NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION;
- String noOfViewsStr = context.getExternalContext().
- getInitParameter(NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION);
- if (noOfViewsStr != null) {
- try {
- noOfViewsInLogicalView =
- Integer.valueOf(noOfViewsStr).intValue();
- } catch (NumberFormatException nfe) {
- if (LOGGER.isLoggable(Level.FINE)) {
+ WebConfiguration webConfig =
+ WebConfiguration.getInstance(context.getExternalContext());
+ String noOfViewsStr = webConfig
+ .getInitParameter(WebContextInitParameter.NumberOfLogicalViews);
+ String defaultValue =
+ WebContextInitParameter.NumberOfLogicalViews.getDefaultValue();
+ try {
+ noOfViewsInLogicalView = Integer.valueOf(noOfViewsStr);
+ } catch (NumberFormatException nfe) {
+ if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Error parsing the servetInitParameter "
+
- NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION
+ WebContextInitParameter.NumberOfLogicalViews.getQualifiedName()
+ ". Using default "
+
noOfViewsInLogicalView);
- }
}
- }
+ try {
+ noOfViewsInLogicalView = Integer.valueOf(defaultValue);
+ } catch (NumberFormatException ne) {
+ // won't occur
+ }
+ }
+
return noOfViewsInLogicalView;
}
@@ -537,28 +534,35 @@
* returns <code>DEFAULT_NUMBER_OF_VIEWS_IN_SESSION</code>.
*/
protected int getNumberOfViewsParameter(FacesContext context) {
-
+
if (noOfViews != 0) {
return noOfViews;
}
- noOfViews = DEFAULT_NUMBER_OF_VIEWS_IN_SESSION;
- String noOfViewsStr = context.getExternalContext().
- getInitParameter(NUMBER_OF_VIEWS_IN_SESSION);
- if (noOfViewsStr != null) {
- try {
- noOfViews = Integer.valueOf(noOfViewsStr).intValue();
- } catch (NumberFormatException nfe) {
- if (LOGGER.isLoggable(Level.FINE)) {
+ WebConfiguration webConfig =
+ WebConfiguration.getInstance(context.getExternalContext());
+ String noOfViewsStr = webConfig
+ .getInitParameter(WebContextInitParameter.NumberOfViews);
+ String defaultValue =
+ WebContextInitParameter.NumberOfViews.getDefaultValue();
+ try {
+ noOfViews = Integer.valueOf(noOfViewsStr);
+ } catch (NumberFormatException nfe) {
+ if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Error parsing the servetInitParameter "
+
- NUMBER_OF_VIEWS_IN_SESSION
+ WebContextInitParameter.NumberOfViews.getQualifiedName()
+ ". Using default "
+
noOfViews);
- }
}
- }
- return noOfViews;
+ try {
+ noOfViews = Integer.valueOf(defaultValue);
+ } catch (NumberFormatException ne) {
+ // won't occur
+ }
+ }
+
+ return noOfViews;
}
Index: src/com/sun/faces/config/ConfigureListener.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/config/ConfigureListener.java,v
retrieving revision 1.69
diff -u -r1.69 ConfigureListener.java
--- src/com/sun/faces/config/ConfigureListener.java 29 Mar 2006 23:03:43 -0000 1.69
+++ src/com/sun/faces/config/ConfigureListener.java 4 Apr 2006 17:32:00 -0000
@@ -103,6 +103,8 @@
import com.sun.faces.util.Util;
import com.sun.faces.util.MessageUtils;
+import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
+
import com.sun.org.apache.commons.digester.Digester;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
@@ -113,7 +115,6 @@
import java.util.logging.Logger;
import java.util.logging.Level;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -222,7 +223,9 @@
* qualified Java class name to a ManagedBeanFactory.</p>
*/
protected static final String MANAGED_BEAN_FACTORY_DECORATOR_CLASS =
- RIConstants.FACES_PREFIX + "managedBeanFactoryDecoratorClass";
+ RIConstants.FACES_PREFIX + "managedBeanFactoryDecoratorClass";
+
+ protected WebConfiguration webConfig;
/**
* <p>All known factory names.</p>
@@ -285,6 +288,7 @@
// flag to disable web.xml scanning completely - to be used
// by subclasses of ConfigureListener.
private boolean shouldScanWebXml = true;
+
// ------------------------------------------ ServletContextListener Methods
@@ -366,6 +370,7 @@
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
+ webConfig = WebConfiguration.getInstance(context);
Digester digester = null;
boolean initialized = false;
@@ -386,8 +391,9 @@
// Check to see if the FacesServlet is present in the
// web.xml. If it is, perform faces configuration as normal,
// otherwise, simply return.
- if (shouldScanWebXml &&
- !isFeatureEnabled(context, FORCE_LOAD_CONFIG)) {
+ if (shouldScanWebXml &&
+ !isFeatureEnabled(BooleanWebContextInitParameter.ForceLoadFacesConfigFiles))
+ {
WebXmlProcessor processor = new WebXmlProcessor(context);
if (!processor.isFacesServletPresent()) {
if (LOGGER.isLoggable(Level.FINE)) {
@@ -404,7 +410,7 @@
+
" processing configuration.");
}
- }
+ }
// Prepare local variables we will need
FacesConfigBean fcb = new FacesConfigBean();
@@ -424,7 +430,7 @@
// see if we need to disable our TLValidator
Util.setHtmlTLVActive(
- isFeatureEnabled(context, ENABLE_HTML_TLV));
+ isFeatureEnabled(BooleanWebContextInitParameter.EnableHtmlTagLibraryValidator));
URL url = null;
if (LOGGER.isLoggable(Level.FINE)) {
@@ -441,7 +447,7 @@
}
// Step 1, configure a Digester instance we can use
- digester = digester(isFeatureEnabled(context, VALIDATE_XML));
+ digester = digester(isFeatureEnabled(BooleanWebContextInitParameter.ValidateFacesConfigFiles));
// Step 2, parse the RI configuration resource
url = Util.getCurrentLoader(this).getResource(JSF_RI_CONFIG);
@@ -538,7 +544,7 @@
// Step 7, verify that all the configured factories are available
// and optionall that configured objects can be created
verifyFactories();
- if (isFeatureEnabled(context, VERIFY_OBJECTS)) {
+ if (isFeatureEnabled(BooleanWebContextInitParameter.VerifyFacesConfigObjects)) {
verifyObjects(context, fcb);
}
// Step 8, register FacesCompositeELResolver and ELContextListener with
@@ -565,9 +571,8 @@
public void contextDestroyed(ServletContextEvent sce) {
-
- try {
- ServletContext context = sce.getServletContext();
+ ServletContext context = sce.getServletContext();
+ try {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("contextDestroyed("
+ context.getServletContextName()
@@ -593,7 +598,8 @@
// Release the initialization mark on this web application
release();
} finally {
- tlsExternalContext.set(null);
+ tlsExternalContext.set(null);
+ WebConfiguration.clear(context);
}
}
@@ -1508,8 +1514,7 @@
private JSFVersionTracker getJSFVersionTracker() {
// If the feature is disabled...
- if (isFeatureEnabled(getExternalContextDuringInitialize().getContext(),
- DISABLE_VERSION_TRACKING)) {
+ if (isFeatureEnabled(BooleanWebContextInitParameter.DisableArtifactVersioning)) {
// make sure the tracker is released.
versionTracker = null;
return null;
@@ -1778,23 +1783,8 @@
* @return <code>true</code> if the feature in question is enabled, otherwise
* <code>false</code>
*/
- protected boolean isFeatureEnabled(Object obj, String paramName) {
- ServletContext context = (ServletContext) obj;
- String paramValue = context.getInitParameter(paramName);
- if (paramValue != null) {
- paramValue = paramValue.trim();
- if (!(paramValue.equals("true")) &&
- !(paramValue.equals("false"))) {
-
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.warning(MessageUtils.getExceptionMessageString(
- MessageUtils.INVALID_INIT_PARAM_ERROR_MESSAGE_ID,
- new Object[] { paramValue, paramName }));
- }
- }
- }
-
- return Boolean.valueOf(paramValue);
+ protected boolean isFeatureEnabled(BooleanWebContextInitParameter param) {
+ return webConfig.getBooleanInitParameter(param);
}
private String getServletContextIdentifier(ServletContext context) {
Index: src/com/sun/faces/config/GlassFishConfigureListener.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/config/GlassFishConfigureListener.java,v
retrieving revision 1.4
diff -u -r1.4 GlassFishConfigureListener.java
--- src/com/sun/faces/config/GlassFishConfigureListener.java 29 Mar 2006 23:03:43 -0000 1.4
+++ src/com/sun/faces/config/GlassFishConfigureListener.java 4 Apr 2006 17:32:00 -0000
@@ -28,6 +28,8 @@
package com.sun.faces.config;
+import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
+
import javax.servlet.ServletContextEvent;
/**
@@ -51,11 +53,8 @@
* Because of EE 5 requirements, we force XML validation.
*/
@Override
- protected boolean isFeatureEnabled(Object obj, String paramName) {
- if (VALIDATE_XML.equals(paramName)) {
- return true;
- } else {
- return super.isFeatureEnabled(obj, paramName);
- }
+ protected boolean isFeatureEnabled(BooleanWebContextInitParameter param) {
+ return BooleanWebContextInitParameter.ValidateFacesConfigFiles
+ .equals(param) || super.isFeatureEnabled(param);
}
}
Index: src/com/sun/faces/renderkit/ByteArrayGuard.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/ByteArrayGuard.java,v
retrieving revision 1.11
diff -u -r1.11 ByteArrayGuard.java
--- src/com/sun/faces/renderkit/ByteArrayGuard.java 29 Mar 2006 23:03:46 -0000 1.11
+++ src/com/sun/faces/renderkit/ByteArrayGuard.java 4 Apr 2006 17:32:00 -0000
@@ -36,7 +36,6 @@
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.faces.FacesException;
-import javax.naming.InitialContext;
import java.io.IOException;
import java.security.Key;
@@ -46,7 +45,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.sun.faces.RIConstants;
import com.sun.faces.util.Util;
/**
@@ -65,9 +63,7 @@
Util.getLogger(Util.FACES_LOGGER + Util.RENDERKIT_LOGGER);
private static final int DEFAULT_IV_LENGTH = 8;
private static final int DEFAULT_KEY_LENGTH = 24;
- private static final int DEFAULT_MAC_LENGTH = 20;
-
- private static ByteArrayGuard byteArrayGuard;
+ private static final int DEFAULT_MAC_LENGTH = 20;
private final Object decLock = new Object();
private final Object encLock = new Object();
@@ -91,81 +87,69 @@
* <code>keyLength</code>, <code>macLength</code>, <code>ivLength</code>.
* @param keyLength the length of the key used for encryption
* @param macLength the length of the message authentication used
- * @param ivLength length of the initialization vector used by the block cipher
+ * @param ivLength length of the initialization vector used by the block cipher
+ * @param password the password to seed the encryption
*/
- private ByteArrayGuard(int keyLength, int macLength, int ivLength) {
+ private ByteArrayGuard(int keyLength,
+ int macLength,
+ int ivLength,
+ String password) {
this.keyLength = keyLength;
this.macLength = macLength;
this.ivLength = ivLength;
- if (PASSWORD_KEY == null) {
- InitialContext iContext = null;
+ if (password != null) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.log(Level.FINE,
+ "Client state saving encryption enabled.");
+ }
+ PASSWORD_KEY = convertPasswordToKey(password.getBytes());
try {
- iContext = new InitialContext();
- String password = (String) iContext
- .lookup(RIConstants.CLIENT_STATE_ENC_PASSWORD_ENTRY_NAME);
- if (password != null) {
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE,
- "Client state saving encryption enabled.");
- }
- PASSWORD_KEY = convertPasswordToKey(password.getBytes());
- try {
- prng = SecureRandom.getInstance("SHA1PRNG");
- keygen = SecretKeyFactory.getInstance("DESede");
- encryptCipher =
- getBlockCipherForEncryption(PASSWORD_KEY);
- iVector = encryptCipher.getIV();
- decryptCipher =
- getBlockCipherForDecryption(PASSWORD_KEY,
- iVector);
- } catch (Exception e) {
- if (logger.isLoggable(Level.SEVERE)) {
- logger.log(Level.SEVERE,
- "Unexpected exception initializing encryption."
- + " No encryption will be performed.",
- e);
- }
- PASSWORD_KEY = null;
- keygen = null;
- encryptCipher = null;
- decryptCipher = null;
- iVector = null;
- prng = null;
- }
- }
- } catch (Exception ne) {
- // i18n
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE,
- "Client state saving encryption disabled.",
- ne);
+ prng = SecureRandom.getInstance("SHA1PRNG");
+ keygen = SecretKeyFactory.getInstance("DESede");
+ encryptCipher =
+ getBlockCipherForEncryption(PASSWORD_KEY);
+ iVector = encryptCipher.getIV();
+ decryptCipher =
+ getBlockCipherForDecryption(PASSWORD_KEY,
+ iVector);
+ } catch (Exception e) {
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE,
+ "Unexpected exception initializing encryption."
+ + " No encryption will be performed.",
+ e);
}
- } finally {
- if (iContext != null) {
- try {
- iContext.close();
- } catch (Exception e) {}
- }
- }
- }
-
+ PASSWORD_KEY = null;
+ keygen = null;
+ encryptCipher = null;
+ decryptCipher = null;
+ iVector = null;
+ prng = null;
+ }
+ }
}
// ---------------------------------------------------------- Public Methods
- public static synchronized ByteArrayGuard getInstance() {
-
- if (byteArrayGuard == null) {
- byteArrayGuard = new ByteArrayGuard(DEFAULT_KEY_LENGTH,
- DEFAULT_MAC_LENGTH,
- DEFAULT_IV_LENGTH);
- }
- return byteArrayGuard;
+ public static ByteArrayGuard newInstance() {
+
+ return new ByteArrayGuard(DEFAULT_KEY_LENGTH,
+ DEFAULT_MAC_LENGTH,
+ DEFAULT_IV_LENGTH,
+ null);
+
+ }
+
+ public static ByteArrayGuard newInstance(String password) {
+ return new ByteArrayGuard(DEFAULT_KEY_LENGTH,
+ DEFAULT_MAC_LENGTH,
+ DEFAULT_IV_LENGTH,
+ password);
}
Index: src/com/sun/faces/renderkit/RenderKitImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/RenderKitImpl.java,v
retrieving revision 1.36
diff -u -r1.36 RenderKitImpl.java
--- src/com/sun/faces/renderkit/RenderKitImpl.java 29 Mar 2006 23:03:46 -0000 1.36
+++ src/com/sun/faces/renderkit/RenderKitImpl.java 4 Apr 2006 17:32:00 -0000
@@ -32,6 +32,8 @@
package com.sun.faces.renderkit;
import com.sun.faces.RIConstants;
+import com.sun.faces.config.WebConfiguration;
+import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
import com.sun.faces.renderkit.html_basic.HtmlResponseWriter;
import com.sun.faces.util.MessageUtils;
import com.sun.faces.util.Util;
@@ -98,8 +100,7 @@
private HashMap<String,HashMap<Object,Renderer>> rendererFamilies;
private ResponseStateManager responseStateManager = null;
-
- private boolean preferXhtml = false;
+ private Boolean preferXHTML;
//
// Constructors and Initializers
//
@@ -189,19 +190,11 @@
{ HTML_CONTENT_TYPE, XHTML_CONTENT_TYPE,
APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE };
- // Step 0: Determine if we have a preference for XHTML
- String preferXhtmlParam = context.getExternalContext().getInitParameter(
- RIConstants.PREFER_XHTML);
- if (null != preferXhtmlParam) {
- if (!(preferXhtmlParam.equals("true")) &&
- !(preferXhtmlParam.equals("false"))) {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning(MessageUtils.getExceptionMessageString(
- MessageUtils.INVALID_INIT_PARAM_ERROR_MESSAGE_ID,
- new Object[] { preferXhtmlParam, RIConstants.PREFER_XHTML }));
- }
- }
- preferXhtml = Boolean.valueOf(preferXhtmlParam);
+ // Step 0: Determine if we have a preference for XHTML
+ if (preferXHTML == null) {
+ preferXHTML =
+ WebConfiguration.getInstance(context.getExternalContext())
+ .getBooleanInitParameter(BooleanWebContextInitParameter.PreferXHTMLContentType);
}
// Step 1: Check the content type passed into this method
@@ -256,7 +249,7 @@
if (null == desiredContentTypeList ||
desiredContentTypeList.equals(ALL_MEDIA)) {
Map<String,Object> requestMap = context.getExternalContext().getRequestMap();
- if (preferXhtml) {
+ if (preferXHTML) {
contentType = XHTML_CONTENT_TYPE;
requestMap.put(RIConstants.CONTENT_TYPE_IS_XHTML, Boolean.TRUE);
} else {
@@ -307,7 +300,7 @@
curContentType = supportedTypes[j].trim();
if (-1 != curDesiredType.indexOf(curContentType)) {
if (-1 != curContentType.indexOf(HTML_CONTENT_TYPE)) {
- if (preferXhtml) {
+ if (preferXHTML) {
contentType = XHTML_CONTENT_TYPE;
requestMap.put(RIConstants.CONTENT_TYPE_IS_XHTML, Boolean.TRUE);
} else {
Index: src/com/sun/faces/renderkit/ResponseStateManagerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/ResponseStateManagerImpl.java,v
retrieving revision 1.30
diff -u -r1.30 ResponseStateManagerImpl.java
--- src/com/sun/faces/renderkit/ResponseStateManagerImpl.java 29 Mar 2006 23:03:47 -0000 1.30
+++ src/com/sun/faces/renderkit/ResponseStateManagerImpl.java 4 Apr 2006 17:32:00 -0000
@@ -49,6 +49,9 @@
import com.sun.faces.util.Base64;
import com.sun.faces.util.Util;
+import com.sun.faces.config.WebConfiguration;
+import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
+import com.sun.faces.config.WebConfiguration.WebEnvironmentEntry;
import java.util.logging.Logger;
import java.util.logging.Level;
@@ -68,9 +71,7 @@
Util.getLogger(Util.FACES_LOGGER + Util.RENDERKIT_LOGGER);
private static final String FACES_VIEW_STATE =
"com.sun.faces.FACES_VIEW_STATE";
-
- private static final String COMPRESS_STATE_PARAM =
- "com.sun.faces.COMPRESS_STATE";
+
//
// Class Variables
//
@@ -78,7 +79,7 @@
//
// Instance Variables
//
- private Boolean compressStateSet = null;
+ private Boolean compressState = null;
private ByteArrayGuard byteArrayGuard = null;
//
@@ -95,7 +96,11 @@
public ResponseStateManagerImpl() {
super();
- byteArrayGuard = ByteArrayGuard.getInstance();
+ WebConfiguration webConfig = WebConfiguration.getInstance();
+ assert (webConfig != null);
+ byteArrayGuard = ByteArrayGuard
+ .newInstance(webConfig.getEnvironmentEntry(
+ WebEnvironmentEntry.ClientStateSavingPassword));
}
@@ -269,17 +274,14 @@
private boolean isCompressStateSet(FacesContext context) {
- if (null != compressStateSet) {
- return compressStateSet;
- }
- compressStateSet = Boolean.TRUE;
-
- String compressStateParam = context.getExternalContext().
- getInitParameter(COMPRESS_STATE_PARAM);
- if (compressStateParam != null){
- compressStateSet = Boolean.valueOf(compressStateParam);
+ if (null != compressState) {
+ return compressState;
}
- return compressStateSet;
+ compressState = WebConfiguration
+ .getInstance(context.getExternalContext())
+ .getBooleanInitParameter(BooleanWebContextInitParameter.CompressViewState);
+
+ return compressState;
}
Index: systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java,v
retrieving revision 1.8
diff -u -r1.8 CustomResponseStateManagerImpl.java
--- systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java 29 Mar 2006 23:04:02 -0000 1.8
+++ systest/src/com/sun/faces/systest/render/CustomResponseStateManagerImpl.java 4 Apr 2006 17:32:00 -0000
@@ -91,7 +91,7 @@
public CustomResponseStateManagerImpl() {
super();
- byteArrayGuard = ByteArrayGuard.getInstance();
+ byteArrayGuard = ByteArrayGuard.newInstance();
}
Index: test/com/sun/faces/config/ConfigFileTestCase.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/config/ConfigFileTestCase.java,v
retrieving revision 1.74
diff -u -r1.74 ConfigFileTestCase.java
--- test/com/sun/faces/config/ConfigFileTestCase.java 29 Mar 2006 23:04:42 -0000 1.74
+++ test/com/sun/faces/config/ConfigFileTestCase.java 4 Apr 2006 17:32:00 -0000
@@ -30,10 +30,14 @@
package com.sun.faces.config;
import com.sun.faces.cactus.ServletFacesTestCase;
+import com.sun.faces.cactus.TestingUtil;
import com.sun.faces.application.ApplicationAssociate;
import com.sun.faces.application.ApplicationImpl;
import com.sun.faces.config.beans.FacesConfigBean;
+import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
import com.sun.faces.util.Util;
+import com.sun.faces.util.TestUtil;
+
import org.apache.cactus.WebRequest;
import com.sun.org.apache.commons.digester.Digester;
@@ -68,8 +72,16 @@
List mappings;
ConfigParser parser = new ConfigParser();
- public static class ConfigParser extends ConfigureListener {
+ public class ConfigParser extends ConfigureListener {
public void parseFromStr(ServletContext context, String str) throws Exception {
+ if (webConfig == null) {
+ webConfig = (WebConfiguration)
+ TestingUtil.invokePrivateMethod("getInstance",
+ new Class[]{ServletContext.class},
+ new Object[]{context},
+ WebConfiguration.class,
+ null);
+ }
Digester digester = null;
URL url = null;
FacesConfigBean fcb =
@@ -77,7 +89,8 @@
fcb.getApplication().clearResourceBundles();
// Step 1, configure a Digester instance we can use
- digester = digester(isFeatureEnabled(context, VALIDATE_XML));
+ digester =
+ digester(true);
url = context.getResource(str);
//url = new URL(url, str);
SECTION: New Files
----------------------------
SEE ATTACHMENTS