You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/02/02 21:00:44 UTC
svn commit: r1239799 [1/9] - in
/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared:
application/ config/ context/flash/ renderkit/ renderkit/html/
renderkit/html/util/ resource/ util/ util/io/ util/xml/
Author: lu4242
Date: Thu Feb 2 20:00:42 2012
New Revision: 1239799
URL: http://svn.apache.org/viewvc?rev=1239799&view=rev
Log:
synch with impl shared
Added:
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSelectableRendererBase.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/SharedStringBuilder.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/StreamCharBuffer.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/StringCharArrayAccessor.java (with props)
Modified:
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/JavascriptContext.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/UnicodeEncoder.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/xml/MyFacesErrorHandler.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/xml/XmlUtils.java
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1239799&r1=1239798&r2=1239799&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Thu Feb 2 20:00:42 2012
@@ -31,7 +31,9 @@ import javax.faces.context.ExternalConte
import javax.faces.context.FacesContext;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.shared.renderkit.html.util.SharedStringBuilder;
import org.apache.myfaces.shared.util.ExternalContextUtils;
+import org.apache.myfaces.shared.util.StringUtils;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
/**
@@ -55,7 +57,8 @@ public class DefaultViewHandlerSupport i
/**
* Controls the size of the cache used to "remember" if a view exists or not.
*/
- @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="viewhandler", tags="performance", classType="java.lang.Integer",
+ @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="viewhandler", tags="performance",
+ classType="java.lang.Integer",
desc="Controls the size of the cache used to 'remember' if a view exists or not.")
private static final String CHECKED_VIEWID_CACHE_SIZE_ATTRIBUTE = "org.apache.myfaces.CHECKED_VIEWID_CACHE_SIZE";
private static final int CHECKED_VIEWID_CACHE_DEFAULT_SIZE = 500;
@@ -64,10 +67,15 @@ public class DefaultViewHandlerSupport i
* Enable or disable a cache used to "remember" if a view exists or not and reduce the impact of
* sucesive calls to ExternalContext.getResource().
*/
- @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", expectedValues="true, false", group="viewhandler", tags="performance",
- desc="Enable or disable a cache used to 'remember' if a view exists or not and reduce the impact of sucesive calls to ExternalContext.getResource().")
- private static final String CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE = "org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED";
+ @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", expectedValues="true, false", group="viewhandler",
+ tags="performance",
+ desc="Enable or disable a cache used to 'remember' if a view exists or not and reduce the impact " +
+ "of sucesive calls to ExternalContext.getResource().")
+ private static final String CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE =
+ "org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED";
private static final boolean CHECKED_VIEWID_CACHE_ENABLED_DEFAULT = true;
+
+ private static final String VIEW_HANDLER_SUPPORT_SB = "oam.viewhandler.SUPPORT_SB";
private Map<String, Boolean> _checkedViewIdMap = null;
private Boolean _checkedViewIdCacheEnabled = null;
@@ -167,7 +175,9 @@ public class DefaultViewHandlerSupport i
FacesServletMapping mapping = getFacesServletMapping(context);
ExternalContext externalContext = context.getExternalContext();
String contextPath = externalContext.getRequestContextPath();
- StringBuilder builder = new StringBuilder(contextPath);
+ //StringBuilder builder = new StringBuilder(contextPath);
+ StringBuilder builder = SharedStringBuilder.get(context, VIEW_HANDLER_SUPPORT_SB);
+ builder.append(contextPath);
if (mapping != null)
{
if (mapping.isExtensionMapping())
@@ -188,11 +198,15 @@ public class DefaultViewHandlerSupport i
if (!founded)
{
//See JSF 2.0 section 7.5.2
- // - If the argument viewId has an extension, and this extension is mapping, the result is contextPath + viewId
+ // - If the argument viewId has an extension, and this extension is mapping,
+ // the result is contextPath + viewId
//
- // -= Leonardo Uribe =- It is evident that when the page is generated, the derived viewId will end with the
- // right contextSuffix, and a navigation entry on faces-config.xml should use such id, this is just a workaroud
- // for usability. There is a potential risk that change the mapping in a webapp make the same application fail,
+ // -= Leonardo Uribe =- It is evident that when the page is generated, the derived
+ // viewId will end with the
+ // right contextSuffix, and a navigation entry on faces-config.xml should use such id,
+ // this is just a workaroud
+ // for usability. There is a potential risk that change the mapping in a webapp make
+ // the same application fail,
// so use viewIds ending with mapping extensions is not a good practice.
if (viewId.endsWith(mapping.getExtension()))
{
@@ -303,7 +317,7 @@ public class DefaultViewHandlerSupport i
{
defaultSuffix = ViewHandler.DEFAULT_SUFFIX;
}
- return defaultSuffix.split(" ");
+ return StringUtils.splitShortString(defaultSuffix, ' ');
}
protected String getFaceletsContextSuffix(FacesContext context)
@@ -320,13 +334,14 @@ public class DefaultViewHandlerSupport i
protected String[] getFaceletsViewMappings(FacesContext context)
{
- String faceletsViewMappings= context.getExternalContext().getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
+ String faceletsViewMappings= context.getExternalContext().getInitParameter(
+ ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
if(faceletsViewMappings == null) //consider alias facelets.VIEW_MAPPINGS
{
faceletsViewMappings= context.getExternalContext().getInitParameter("facelets.VIEW_MAPPINGS");
}
- return faceletsViewMappings == null ? null : faceletsViewMappings.split(";");
+ return faceletsViewMappings == null ? null : StringUtils.splitShortString(faceletsViewMappings, ';');
}
/**
@@ -401,10 +416,14 @@ public class DefaultViewHandlerSupport i
int slashPos = requestViewId.lastIndexOf('/');
int extensionPos = requestViewId.lastIndexOf('.');
+ StringBuilder builder = SharedStringBuilder.get(context, VIEW_HANDLER_SUPPORT_SB);
+
//Try to locate any resource that match with the expected id
for (String defaultSuffix : jspDefaultSuffixes)
{
- StringBuilder builder = new StringBuilder(requestViewId);
+ //StringBuilder builder = new StringBuilder(requestViewId);
+ builder.setLength(0);
+ builder.append(requestViewId);
if (extensionPos > -1 && extensionPos > slashPos)
{
@@ -435,14 +454,18 @@ public class DefaultViewHandlerSupport i
builder.replace(candidateViewId.lastIndexOf('.'), candidateViewId.length(), mapping);
String tempViewId = builder.toString();
if(checkResourceExists(context,tempViewId))
+ {
return tempViewId;
+ }
}
}
}
// forced facelets mappings did not match or there were no entries in faceletsViewMappings array
if(checkResourceExists(context,candidateViewId))
+ {
return candidateViewId;
+ }
}
@@ -461,7 +484,9 @@ public class DefaultViewHandlerSupport i
}
if (faceletsDefaultSuffix != null)
{
- StringBuilder builder = new StringBuilder(requestViewId);
+ //StringBuilder builder = new StringBuilder(requestViewId);
+ builder.setLength(0);
+ builder.append(requestViewId);
if (extensionPos > -1 && extensionPos > slashPos)
{
@@ -474,12 +499,16 @@ public class DefaultViewHandlerSupport i
String candidateViewId = builder.toString();
if(checkResourceExists(context,candidateViewId))
+ {
return candidateViewId;
+ }
}
// Otherwise, if a physical resource exists with the name requestViewId let that value be viewId.
if(checkResourceExists(context,requestViewId))
+ {
return requestViewId;
+ }
//Otherwise return null.
return null;
@@ -518,7 +547,8 @@ public class DefaultViewHandlerSupport i
{
if (_checkedViewIdMap == null)
{
- _checkedViewIdMap = Collections.synchronizedMap(new _CheckedViewIDMap<String, Boolean>(getViewIDCacheMaxSize(context)));
+ _checkedViewIdMap = Collections.synchronizedMap(
+ new _CheckedViewIDMap<String, Boolean>(getViewIDCacheMaxSize(context)));
}
return _checkedViewIdMap;
}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java?rev=1239799&r1=1239798&r2=1239799&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java Thu Feb 2 20:00:42 2012
@@ -1,107 +1,107 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.application;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-/**
- *
- * @author Leonardo Uribe
- *
- */
-public class NavigationUtils
-{
- /**
- * Evaluate all EL expressions found as parameters and return a map that can be used for
- * redirect or render bookmark links
- *
- * @param parameters parameter map retrieved from NavigationCase.getParameters()
- * @return
- */
- public static Map<String, List<String> > getEvaluatedNavigationParameters(Map<String, List<String> > parameters)
- {
- Map<String,List<String>> evaluatedParameters = null;
- if (parameters != null && parameters.size() > 0)
- {
- evaluatedParameters = new HashMap<String, List<String>>();
- for (Map.Entry<String, List<String>> pair : parameters.entrySet())
- {
- boolean containsEL = false;
- for (String value : pair.getValue())
- {
- if (_isExpression(value))
- {
- containsEL = true;
- break;
- }
- }
- if (containsEL)
- {
- evaluatedParameters.put(pair.getKey(), _evaluateValueExpressions(pair.getValue()));
- }
- else
- {
- evaluatedParameters.put(pair.getKey(), pair.getValue());
- }
- }
- }
- else
- {
- evaluatedParameters = parameters;
- }
- return evaluatedParameters;
- }
-
- /**
- * Checks the Strings in the List for EL expressions and evaluates them.
- * Note that the returned List will be a copy of the given List, because
- * otherwise it will have unwanted side-effects.
- * @param values
- * @return
- */
- private static List<String> _evaluateValueExpressions(List<String> values)
- {
- // note that we have to create a new List here, because if we
- // change any value on the given List, it will be changed in the
- // NavigationCase too and the EL expression won't be evaluated again
- List<String> target = new ArrayList<String>(values.size());
- FacesContext context = FacesContext.getCurrentInstance();
- for (String value : values)
- {
- if (_isExpression(value))
- {
- // evaluate the ValueExpression
- value = context.getApplication().evaluateExpressionGet(context, value, String.class);
- }
- target.add(value);
- }
- return target;
- }
-
- private static boolean _isExpression(String text)
- {
- return text.indexOf("#{") != -1;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.application;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ *
+ * @author Leonardo Uribe
+ *
+ */
+public class NavigationUtils
+{
+ /**
+ * Evaluate all EL expressions found as parameters and return a map that can be used for
+ * redirect or render bookmark links
+ *
+ * @param parameters parameter map retrieved from NavigationCase.getParameters()
+ * @return
+ */
+ public static Map<String, List<String> > getEvaluatedNavigationParameters(Map<String, List<String> > parameters)
+ {
+ Map<String,List<String>> evaluatedParameters = null;
+ if (parameters != null && parameters.size() > 0)
+ {
+ evaluatedParameters = new HashMap<String, List<String>>();
+ for (Map.Entry<String, List<String>> pair : parameters.entrySet())
+ {
+ boolean containsEL = false;
+ for (String value : pair.getValue())
+ {
+ if (_isExpression(value))
+ {
+ containsEL = true;
+ break;
+ }
+ }
+ if (containsEL)
+ {
+ evaluatedParameters.put(pair.getKey(), _evaluateValueExpressions(pair.getValue()));
+ }
+ else
+ {
+ evaluatedParameters.put(pair.getKey(), pair.getValue());
+ }
+ }
+ }
+ else
+ {
+ evaluatedParameters = parameters;
+ }
+ return evaluatedParameters;
+ }
+
+ /**
+ * Checks the Strings in the List for EL expressions and evaluates them.
+ * Note that the returned List will be a copy of the given List, because
+ * otherwise it will have unwanted side-effects.
+ * @param values
+ * @return
+ */
+ private static List<String> _evaluateValueExpressions(List<String> values)
+ {
+ // note that we have to create a new List here, because if we
+ // change any value on the given List, it will be changed in the
+ // NavigationCase too and the EL expression won't be evaluated again
+ List<String> target = new ArrayList<String>(values.size());
+ FacesContext context = FacesContext.getCurrentInstance();
+ for (String value : values)
+ {
+ if (_isExpression(value))
+ {
+ // evaluate the ValueExpression
+ value = context.getApplication().evaluateExpressionGet(context, value, String.class);
+ }
+ target.add(value);
+ }
+ return target;
+ }
+
+ private static boolean _isExpression(String text)
+ {
+ return text.indexOf("#{") != -1;
+ }
+
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1239799&r1=1239798&r2=1239799&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Thu Feb 2 20:00:42 2012
@@ -321,8 +321,8 @@ public class MyfacesConfig
* Detect if a target (usually head) should be update for the current view in an ajax render
* operation. This is activated if a css or js resource is added dynamically by effect of a refresh
* (c:if, ui:include src="#{...}" or a manipulation of the tree). This ensures ajax updates of content
- * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to ensure strict compatibility with the spec,
- * set this param to false (default false).
+ * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to
+ * ensure strict compatibility with the spec, set this param to false (default false).
*/
@JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false")
public final static String INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX =
@@ -330,14 +330,18 @@ public class MyfacesConfig
public final static boolean INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT = false;
/**
- * Change default getType() behavior for composite component EL resolver, from return null (see JSF 2_0 spec section 5_6_2_2) to
- * use the metadata information added by composite:attribute, ensuring components working with chained EL expressions to find the
+ * Change default getType() behavior for composite component EL resolver, from return null
+ * (see JSF 2_0 spec section 5_6_2_2) to
+ * use the metadata information added by composite:attribute, ensuring components working with
+ * chained EL expressions to find the
* right type when a getType() is called over the source EL expression.
*
- * To ensure strict compatibility with the spec set this param to true (by default is false, so the change is enabled by default).
+ * To ensure strict compatibility with the spec set this param to true (by default is false,
+ * so the change is enabled by default).
*/
@JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
- public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER = "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
+ public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER =
+ "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
public final static boolean INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
/**
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java?rev=1239799&r1=1239798&r2=1239799&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java Thu Feb 2 20:00:42 2012
@@ -46,9 +46,13 @@ final class SubKeyMap<V> extends Abstrac
public SubKeyMap(Map<String, Object> base, String prefix)
{
if (base == null)
+ {
throw new NullPointerException();
+ }
if (prefix == null)
+ {
throw new NullPointerException();
+ }
// Optimize the scenario where we're wrapping another SubKeyMap
if (base instanceof SubKeyMap)
@@ -61,6 +65,7 @@ final class SubKeyMap<V> extends Abstrac
_base = base;
_prefix = prefix;
}
+ _keyBuffer = new StringBuilder(32);
}
@Override
@@ -94,7 +99,9 @@ final class SubKeyMap<V> extends Abstrac
public boolean containsKey(Object key)
{
if (!(key instanceof String))
+ {
return false;
+ }
return _base.containsKey(_getBaseKey(key));
}
@@ -103,16 +110,24 @@ final class SubKeyMap<V> extends Abstrac
public Set<Map.Entry<String, V>> entrySet()
{
if (_entrySet == null)
+ {
_entrySet = new Entries<V>();
+ }
return _entrySet;
}
private String _getBaseKey(Object key)
{
if (key == null)
+ {
throw new NullPointerException();
+ }
// Yes, I want a ClassCastException if it's not a String
- return _prefix + ((String) key);
+ //return _prefix + ((String) key);
+ _keyBuffer.setLength(0);
+ _keyBuffer.append(_prefix);
+ _keyBuffer.append((String) key);
+ return _keyBuffer.toString();
}
private List<String> _gatherKeys()
@@ -121,7 +136,9 @@ final class SubKeyMap<V> extends Abstrac
for (String key : _base.keySet())
{
if (key != null && key.startsWith(_prefix))
+ {
list.add(key);
+ }
}
return list;
@@ -154,7 +171,9 @@ final class SubKeyMap<V> extends Abstrac
for (String key : _base.keySet())
{
if (key != null && key.startsWith(_prefix))
+ {
size++;
+ }
}
return size;
@@ -170,7 +189,9 @@ final class SubKeyMap<V> extends Abstrac
// Short-circuit: the default implementation would always
// need to iterate to find the total size.
if (key != null && key.startsWith(_prefix))
+ {
return false;
+ }
}
return true;
@@ -213,7 +234,9 @@ final class SubKeyMap<V> extends Abstrac
public void remove()
{
if (_currentKey == null)
+ {
throw new IllegalStateException();
+ }
_base.remove(_currentKey);
@@ -234,7 +257,9 @@ final class SubKeyMap<V> extends Abstrac
public String getKey()
{
if (_key == null)
+ {
_key = _baseKey.substring(_prefix.length());
+ }
return _key;
}
@@ -253,7 +278,9 @@ final class SubKeyMap<V> extends Abstrac
public boolean equals(Object o)
{
if (!(o instanceof Map.Entry))
+ {
return false;
+ }
Map.Entry<String, V> e = (Map.Entry<String, V>) o;
return _equals(getKey(), e.getKey())
&& _equals(getValue(), e.getValue());
@@ -275,12 +302,15 @@ final class SubKeyMap<V> extends Abstrac
static private boolean _equals(Object a, Object b)
{
if (a == null)
+ {
return b == null;
+ }
return a.equals(b);
}
private final Map<String, Object> _base;
private final String _prefix;
private Set<Map.Entry<String, V>> _entrySet;
+ private StringBuilder _keyBuffer;
}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java?rev=1239799&r1=1239798&r2=1239799&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java Thu Feb 2 20:00:42 2012
@@ -1,133 +1,136 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.renderkit;
-
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
-import org.apache.myfaces.shared.util.StringUtils;
-
-/**
- *
- * @author Leonardo Uribe
- *
- */
-public class ContentTypeUtils
-{
- public static final String HTML_CONTENT_TYPE = "text/html";
- public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
- public static final String ANY_CONTENT_TYPE = "*/*";
-
- public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE, ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
-
- public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
- public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
- public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
-
- public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE, APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
-
- public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
-
-
- /**
- * Indicate if the passes content type match one of the options passed.
- */
- public static boolean containsContentType(String contentType, String[] allowedContentTypes)
- {
- if (allowedContentTypes == null)
- {
- return false;
- }
- for (int i = 0; i < allowedContentTypes.length; i++)
- {
- if (allowedContentTypes[i].indexOf(contentType) != -1)
- {
- return true;
- }
- }
- return false;
- }
-
- public static String chooseWriterContentType(String contentTypeListString, String[] htmlContentTypes, String[] xhtmlContentTypes)
- {
- String[] contentTypeList = splitContentTypeListString(contentTypeListString);
- String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
- String selectedContentType = null;
- for (int i = 0; i < supportedContentTypeArray.length; i++)
- {
- String supportedContentType = supportedContentTypeArray[i].trim();
-
- for (int j = 0; j < contentTypeList.length; j++)
- {
- String contentType = (String) contentTypeList[j];
-
- if (contentType.indexOf(supportedContentType) != -1)
- {
- if (containsContentType(contentType, htmlContentTypes))
- {
- selectedContentType = HTML_CONTENT_TYPE;
- }
- else if (containsContentType(contentType, xhtmlContentTypes))
- {
- selectedContentType = XHTML_CONTENT_TYPE;
- }
- break;
- }
- }
- if (selectedContentType != null)
- {
- break;
- }
- }
- return selectedContentType;
- }
-
- public static String[] splitContentTypeListString(String contentTypeListString)
- {
- String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
- for (int i = 0; i < splittedArray.length; i++)
- {
- int semicolonIndex = splittedArray[i].indexOf(";");
- if (semicolonIndex != -1)
- {
- splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
- }
- }
- return splittedArray;
- }
-
- public static String getContentTypeFromAcceptHeader(FacesContext context)
- {
- String contentTypeListString = (String) context.getExternalContext()
- .getRequestHeaderMap().get("Accept");
- // There is a windows mobile IE client (6.12) sending
- // "application/vnd.wap.mms-message;*/*"
- // Note that the Accept header should be written as
- // "application/vnd.wap.mms-message,*/*" ,
- // so this is bug of the client. Anyway, this is a workaround ...
- if (contentTypeListString != null
- && contentTypeListString
- .startsWith("application/vnd.wap.mms-message;*/*"))
- {
- contentTypeListString = "*/*";
- }
- return contentTypeListString;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.shared.util.StringUtils;
+
+/**
+ *
+ * @author Leonardo Uribe
+ *
+ */
+public class ContentTypeUtils
+{
+ public static final String HTML_CONTENT_TYPE = "text/html";
+ public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
+ public static final String ANY_CONTENT_TYPE = "*/*";
+
+ public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE,
+ ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
+
+ public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
+ public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
+ public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
+
+ public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE,
+ APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
+
+ public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
+
+
+ /**
+ * Indicate if the passes content type match one of the options passed.
+ */
+ public static boolean containsContentType(String contentType, String[] allowedContentTypes)
+ {
+ if (allowedContentTypes == null)
+ {
+ return false;
+ }
+ for (int i = 0; i < allowedContentTypes.length; i++)
+ {
+ if (allowedContentTypes[i].indexOf(contentType) != -1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static String chooseWriterContentType(String contentTypeListString,
+ String[] htmlContentTypes, String[] xhtmlContentTypes)
+ {
+ String[] contentTypeList = splitContentTypeListString(contentTypeListString);
+ String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
+ String selectedContentType = null;
+ for (int i = 0; i < supportedContentTypeArray.length; i++)
+ {
+ String supportedContentType = supportedContentTypeArray[i].trim();
+
+ for (int j = 0; j < contentTypeList.length; j++)
+ {
+ String contentType = (String) contentTypeList[j];
+
+ if (contentType.indexOf(supportedContentType) != -1)
+ {
+ if (containsContentType(contentType, htmlContentTypes))
+ {
+ selectedContentType = HTML_CONTENT_TYPE;
+ }
+ else if (containsContentType(contentType, xhtmlContentTypes))
+ {
+ selectedContentType = XHTML_CONTENT_TYPE;
+ }
+ break;
+ }
+ }
+ if (selectedContentType != null)
+ {
+ break;
+ }
+ }
+ return selectedContentType;
+ }
+
+ public static String[] splitContentTypeListString(String contentTypeListString)
+ {
+ String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
+ for (int i = 0; i < splittedArray.length; i++)
+ {
+ int semicolonIndex = splittedArray[i].indexOf(";");
+ if (semicolonIndex != -1)
+ {
+ splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
+ }
+ }
+ return splittedArray;
+ }
+
+ public static String getContentTypeFromAcceptHeader(FacesContext context)
+ {
+ String contentTypeListString = (String) context.getExternalContext()
+ .getRequestHeaderMap().get("Accept");
+ // There is a windows mobile IE client (6.12) sending
+ // "application/vnd.wap.mms-message;*/*"
+ // Note that the Accept header should be written as
+ // "application/vnd.wap.mms-message,*/*" ,
+ // so this is bug of the client. Anyway, this is a workaround ...
+ if (contentTypeListString != null
+ && contentTypeListString
+ .startsWith("application/vnd.wap.mms-message;*/*"))
+ {
+ contentTypeListString = "*/*";
+ }
+ return contentTypeListString;
+ }
+
+}