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 22:12:46 UTC
svn commit: r1239850 - in /myfaces/shared/trunk_4.0.x/core/src/main:
java/org/apache/myfaces/shared/application/
java/org/apache/myfaces/shared/renderkit/
java/org/apache/myfaces/shared/resource/
java/org/apache/myfaces/shared/util/io/ resources/META-INF/
Author: lu4242
Date: Thu Feb 2 21:12:45 2012
New Revision: 1239850
URL: http://svn.apache.org/viewvc?rev=1239850&view=rev
Log:
sync with myfaces impl shared
Modified:
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/renderkit/ContentTypeUtils.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/io/DynamicPushbackInputStream.java
myfaces/shared/trunk_4.0.x/core/src/main/resources/META-INF/myfaces-metadata.xml
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=1239850&r1=1239849&r2=1239850&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 21:12:45 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/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=1239850&r1=1239849&r2=1239850&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 21:12:45 2012
@@ -1,136 +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;
+ }
+
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java?rev=1239850&r1=1239849&r2=1239850&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java Thu Feb 2 21:12:45 2012
@@ -1,100 +1,100 @@
-/*
- * 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.resource;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Comparator;
-
-import javax.faces.FacesWrapper;
-
-/**
- *
- * @author Leonardo Uribe
- *
- */
-public abstract class ResourceLoaderWrapper extends ResourceLoader implements FacesWrapper<ResourceLoader>
-{
-
- public ResourceLoaderWrapper()
- {
- super(null);
- }
-
- public String getResourceVersion(String path)
- {
- return getWrapped().getResourceVersion(path);
- }
-
- public String getLibraryVersion(String path)
- {
- return getWrapped().getLibraryVersion(path);
- }
-
- public URL getResourceURL(ResourceMeta resourceMeta)
- {
- return getWrapped().getResourceURL(resourceMeta);
- }
-
- public InputStream getResourceInputStream(ResourceMeta resourceMeta)
- {
- return getWrapped().getResourceInputStream(resourceMeta);
- }
-
- public ResourceMeta createResourceMeta(String prefix, String libraryName,
- String libraryVersion, String resourceName, String resourceVersion)
- {
- return getWrapped().createResourceMeta(prefix, libraryName, libraryVersion,
- resourceName, resourceVersion);
- }
-
- public boolean libraryExists(String libraryName)
- {
- return getWrapped().libraryExists(libraryName);
- }
-
- public String getPrefix()
- {
- return getWrapped().getPrefix();
- }
-
- public void setPrefix(String prefix)
- {
- getWrapped().setPrefix(prefix);
- }
-
- @Override
- public boolean resourceExists(ResourceMeta resourceMeta)
- {
- return getWrapped().resourceExists(resourceMeta);
- }
-
- @Override
- protected Comparator<String> getVersionComparator()
- {
- return getWrapped().getVersionComparator();
- }
-
- @Override
- protected void setVersionComparator(Comparator<String> versionComparator)
- {
- getWrapped().setVersionComparator(versionComparator);
- }
-
-}
+/*
+ * 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.resource;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Comparator;
+
+import javax.faces.FacesWrapper;
+
+/**
+ *
+ * @author Leonardo Uribe
+ *
+ */
+public abstract class ResourceLoaderWrapper extends ResourceLoader implements FacesWrapper<ResourceLoader>
+{
+
+ public ResourceLoaderWrapper()
+ {
+ super(null);
+ }
+
+ public String getResourceVersion(String path)
+ {
+ return getWrapped().getResourceVersion(path);
+ }
+
+ public String getLibraryVersion(String path)
+ {
+ return getWrapped().getLibraryVersion(path);
+ }
+
+ public URL getResourceURL(ResourceMeta resourceMeta)
+ {
+ return getWrapped().getResourceURL(resourceMeta);
+ }
+
+ public InputStream getResourceInputStream(ResourceMeta resourceMeta)
+ {
+ return getWrapped().getResourceInputStream(resourceMeta);
+ }
+
+ public ResourceMeta createResourceMeta(String prefix, String libraryName,
+ String libraryVersion, String resourceName, String resourceVersion)
+ {
+ return getWrapped().createResourceMeta(prefix, libraryName, libraryVersion,
+ resourceName, resourceVersion);
+ }
+
+ public boolean libraryExists(String libraryName)
+ {
+ return getWrapped().libraryExists(libraryName);
+ }
+
+ public String getPrefix()
+ {
+ return getWrapped().getPrefix();
+ }
+
+ public void setPrefix(String prefix)
+ {
+ getWrapped().setPrefix(prefix);
+ }
+
+ @Override
+ public boolean resourceExists(ResourceMeta resourceMeta)
+ {
+ return getWrapped().resourceExists(resourceMeta);
+ }
+
+ @Override
+ protected Comparator<String> getVersionComparator()
+ {
+ return getWrapped().getVersionComparator();
+ }
+
+ @Override
+ protected void setVersionComparator(Comparator<String> versionComparator)
+ {
+ getWrapped().setVersionComparator(versionComparator);
+ }
+
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java?rev=1239850&r1=1239849&r2=1239850&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java Thu Feb 2 21:12:45 2012
@@ -1,199 +1,199 @@
-/*
- * 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.resource;
-
-public class ResourceValidationUtils
-{
- public static boolean isValidResourceName(String resourceName)
- {
- return validateResourceName(resourceName, true);
- }
-
- public static boolean isValidLibraryName(String libraryName)
- {
- return validate(libraryName, false);
- }
-
- public static boolean isValidLibraryName(String libraryName, boolean allowSlash)
- {
- return validate(libraryName, allowSlash);
- }
-
- public static boolean isValidLocalePrefix(String localePrefix)
- {
- for (int i = 0; i < localePrefix.length(); i++)
- {
- char c = localePrefix.charAt(i);
- if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') || (c >='0' && c <='9') )
- {
- continue;
- }
- else
- {
- return false;
- }
- }
- return true;
- }
-
- private static boolean validate(String expression, boolean allowSlash)
- {
- if (expression.length() == 2 &&
- expression.charAt(0) == '.' &&
- expression.charAt(1) == '.')
- {
- return false;
- }
- for (int i = 0; i < expression.length(); i++)
- {
- char c = expression.charAt(i);
-
- // Enforce NameChar convention as specified
- // http://www.w3.org/TR/REC-xml/#NT-NameChar
- // Valid characters for NameChar
- // ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
- // [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] |
- // [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
- // | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
- // "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
- // Excluding ":"
- if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') ||
- (c >=0xC0 && c <=0xD6) || (c >=0xD8 && c <=0xF6) ||
- (c >=0xF8 && c <=0x2FF) || (c >=0x370 && c <=0x37D) ||
- (c >=0x37F && c <=0x1FFF) || (c >=0x200C && c <=0x200D) ||
- (c >=0x2070 && c <=0x218F) || (c >=0x2C00 && c <=0x2FEF) ||
- (c >=0x3001 && c <=0xD7FF) || (c >=0xF900 && c <=0xFDCF) ||
- (c >=0xFDF0 && c <=0xFFFD) || (c >=0x10000 && c <=0xEFFFF) ||
- c == '-' || (c >='0' && c <='9') || c == 0xB7 || (c >=0x300 && c <=0x36F) ||
- (c >=0x203F && c <=0x2040) || (allowSlash && c == '/')
- )
- {
- continue;
- }
- else if (c == '.')
- {
- if (i+2 < expression.length())
- {
- char c1 = expression.charAt(i+1);
- char c2 = expression.charAt(i+2);
- if (c == c1 && (c2 == '/' || c2 == '\\' ) )
- {
- return false;
- }
- }
- continue;
- }
- else
- {
- return false;
- }
- }
- if (expression.length() >= 3)
- {
- int length = expression.length();
- if ( (expression.charAt(length-3) == '/' || expression.charAt(length-3) == '\\' ) &&
- expression.charAt(length-2) == '.' &&
- expression.charAt(length-1) == '.' )
- {
- return false;
- }
- }
- return true;
- }
-
- private static boolean validateResourceName(String expression, boolean allowSlash)
- {
- if (expression.length() == 2 &&
- expression.charAt(0) == '.' &&
- expression.charAt(1) == '.')
- {
- return false;
- }
- for (int i = 0; i < expression.length(); i++)
- {
- char c = expression.charAt(i);
-
- // Enforce NameChar convention as specified
- // http://www.w3.org/TR/REC-xml/#NT-NameChar
- // Valid characters for NameChar
- // ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
- // [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] |
- // [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
- // | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
- // "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
- // Excluding ":"
-
- // Forbidden chars by win
- // < (less than)
- // > (greater than)
- // : (colon)
- // " (double quote)
- // / (forward slash)
- // \ (backslash)
- // | (vertical bar or pipe)
- // ? (question mark)
- // * (asterisk)
- // Do not use chars in UNIX because they have special meaning
- // *&%$|^/\~
- if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') ||
- (c >=0xC0 && c <=0xD6) || (c >=0xD8 && c <=0xF6) ||
- (c >=0xF8 && c <=0x2FF) || (c >=0x370 && c <=0x37D) ||
- (c >=0x37F && c <=0x1FFF) || (c >=0x200C && c <=0x200D) ||
- (c >=0x2070 && c <=0x218F) || (c >=0x2C00 && c <=0x2FEF) ||
- (c >=0x3001 && c <=0xD7FF) || (c >=0xF900 && c <=0xFDCF) ||
- (c >=0xFDF0 && c <=0xFFFD) || (c >=0x10000 && c <=0xEFFFF) ||
- (c == '-') || (c >='0' && c <='9') || c == 0xB7 || (c >=0x300 && c <=0x36F) ||
- (c >=0x203F && c <=0x2040) || (allowSlash && c == '/') ||
- (c == '!') || (c == '#') || (c == '\'') || (c == '(') || (c == ')') ||
- (c == '+') || (c == ',') || (c == ';' ) || (c == '=') ||
- (c == '@') || (c == '[') || (c == ']' ) || (c == '{') || (c == '}'))
- {
- continue;
- }
- else if (c == '.')
- {
- if (i+2 < expression.length())
- {
- char c1 = expression.charAt(i+1);
- char c2 = expression.charAt(i+2);
- if (c == c1 && (c2 == '/' || c2 == '\\' ) )
- {
- return false;
- }
- }
- continue;
- }
- else
- {
- return false;
- }
- }
- if (expression.length() >= 3)
- {
- int length = expression.length();
- if ( (expression.charAt(length-3) == '/' || expression.charAt(length-3) == '\\' ) &&
- expression.charAt(length-2) == '.' &&
- expression.charAt(length-1) == '.' )
- {
- return false;
- }
- }
- return true;
- }
-}
+/*
+ * 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.resource;
+
+public class ResourceValidationUtils
+{
+ public static boolean isValidResourceName(String resourceName)
+ {
+ return validateResourceName(resourceName, true);
+ }
+
+ public static boolean isValidLibraryName(String libraryName)
+ {
+ return validate(libraryName, false);
+ }
+
+ public static boolean isValidLibraryName(String libraryName, boolean allowSlash)
+ {
+ return validate(libraryName, allowSlash);
+ }
+
+ public static boolean isValidLocalePrefix(String localePrefix)
+ {
+ for (int i = 0; i < localePrefix.length(); i++)
+ {
+ char c = localePrefix.charAt(i);
+ if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') || (c >='0' && c <='9') )
+ {
+ continue;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean validate(String expression, boolean allowSlash)
+ {
+ if (expression.length() == 2 &&
+ expression.charAt(0) == '.' &&
+ expression.charAt(1) == '.')
+ {
+ return false;
+ }
+ for (int i = 0; i < expression.length(); i++)
+ {
+ char c = expression.charAt(i);
+
+ // Enforce NameChar convention as specified
+ // http://www.w3.org/TR/REC-xml/#NT-NameChar
+ // Valid characters for NameChar
+ // ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
+ // [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] |
+ // [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
+ // | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
+ // "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
+ // Excluding ":"
+ if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') ||
+ (c >=0xC0 && c <=0xD6) || (c >=0xD8 && c <=0xF6) ||
+ (c >=0xF8 && c <=0x2FF) || (c >=0x370 && c <=0x37D) ||
+ (c >=0x37F && c <=0x1FFF) || (c >=0x200C && c <=0x200D) ||
+ (c >=0x2070 && c <=0x218F) || (c >=0x2C00 && c <=0x2FEF) ||
+ (c >=0x3001 && c <=0xD7FF) || (c >=0xF900 && c <=0xFDCF) ||
+ (c >=0xFDF0 && c <=0xFFFD) || (c >=0x10000 && c <=0xEFFFF) ||
+ c == '-' || (c >='0' && c <='9') || c == 0xB7 || (c >=0x300 && c <=0x36F) ||
+ (c >=0x203F && c <=0x2040) || (allowSlash && c == '/')
+ )
+ {
+ continue;
+ }
+ else if (c == '.')
+ {
+ if (i+2 < expression.length())
+ {
+ char c1 = expression.charAt(i+1);
+ char c2 = expression.charAt(i+2);
+ if (c == c1 && (c2 == '/' || c2 == '\\' ) )
+ {
+ return false;
+ }
+ }
+ continue;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ if (expression.length() >= 3)
+ {
+ int length = expression.length();
+ if ( (expression.charAt(length-3) == '/' || expression.charAt(length-3) == '\\' ) &&
+ expression.charAt(length-2) == '.' &&
+ expression.charAt(length-1) == '.' )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean validateResourceName(String expression, boolean allowSlash)
+ {
+ if (expression.length() == 2 &&
+ expression.charAt(0) == '.' &&
+ expression.charAt(1) == '.')
+ {
+ return false;
+ }
+ for (int i = 0; i < expression.length(); i++)
+ {
+ char c = expression.charAt(i);
+
+ // Enforce NameChar convention as specified
+ // http://www.w3.org/TR/REC-xml/#NT-NameChar
+ // Valid characters for NameChar
+ // ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
+ // [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] |
+ // [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
+ // | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
+ // "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
+ // Excluding ":"
+
+ // Forbidden chars by win
+ // < (less than)
+ // > (greater than)
+ // : (colon)
+ // " (double quote)
+ // / (forward slash)
+ // \ (backslash)
+ // | (vertical bar or pipe)
+ // ? (question mark)
+ // * (asterisk)
+ // Do not use chars in UNIX because they have special meaning
+ // *&%$|^/\~
+ if ( (c >='A' && c <='Z') || c == '_' || (c >='a' && c <='z') ||
+ (c >=0xC0 && c <=0xD6) || (c >=0xD8 && c <=0xF6) ||
+ (c >=0xF8 && c <=0x2FF) || (c >=0x370 && c <=0x37D) ||
+ (c >=0x37F && c <=0x1FFF) || (c >=0x200C && c <=0x200D) ||
+ (c >=0x2070 && c <=0x218F) || (c >=0x2C00 && c <=0x2FEF) ||
+ (c >=0x3001 && c <=0xD7FF) || (c >=0xF900 && c <=0xFDCF) ||
+ (c >=0xFDF0 && c <=0xFFFD) || (c >=0x10000 && c <=0xEFFFF) ||
+ (c == '-') || (c >='0' && c <='9') || c == 0xB7 || (c >=0x300 && c <=0x36F) ||
+ (c >=0x203F && c <=0x2040) || (allowSlash && c == '/') ||
+ (c == '!') || (c == '#') || (c == '\'') || (c == '(') || (c == ')') ||
+ (c == '+') || (c == ',') || (c == ';' ) || (c == '=') ||
+ (c == '@') || (c == '[') || (c == ']' ) || (c == '{') || (c == '}'))
+ {
+ continue;
+ }
+ else if (c == '.')
+ {
+ if (i+2 < expression.length())
+ {
+ char c1 = expression.charAt(i+1);
+ char c2 = expression.charAt(i+2);
+ if (c == c1 && (c2 == '/' || c2 == '\\' ) )
+ {
+ return false;
+ }
+ }
+ continue;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ if (expression.length() >= 3)
+ {
+ int length = expression.length();
+ if ( (expression.charAt(length-3) == '/' || expression.charAt(length-3) == '\\' ) &&
+ expression.charAt(length-2) == '.' &&
+ expression.charAt(length-1) == '.' )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java?rev=1239850&r1=1239849&r2=1239850&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java Thu Feb 2 21:12:45 2012
@@ -1,168 +1,168 @@
-/*
- * 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.resource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PushbackInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ExceptionQueuedEvent;
-import javax.faces.event.ExceptionQueuedEventContext;
-
-import org.apache.myfaces.shared.util.io.DynamicPushbackInputStream;
-
-public class ValueExpressionFilterInputStream extends InputStream
-{
- private PushbackInputStream delegate;
- private String libraryName;
- private String resourceName;
-
- public ValueExpressionFilterInputStream(InputStream in, String libraryName, String resourceName)
- {
- super();
- delegate = new DynamicPushbackInputStream(in,300);
- }
-
- @Override
- public int read() throws IOException
- {
- int c1 = delegate.read();
-
- if (c1 == -1)
- {
- return -1;
- }
-
- if ( ((char)c1) == '#')
- {
- int c2 = delegate.read();
- if (c2 == -1)
- {
- return -1;
- }
- if (((char)c2) == '{')
- {
- //It is a value expression. We need
- //to look for a occurrence of } to
- //extract the expression and evaluate it,
- //the result should be unread.
- List<Integer> expressionList = new ArrayList<Integer>();
- int c3 = delegate.read();
- while ( c3 != -1 && ((char)c3) != '}' )
- {
- expressionList.add(c3);
- c3 = delegate.read();
- }
-
- if (c3 == -1)
- {
- //get back the data, because we can't
- //extract any value expression
- for (int i = 0; i < expressionList.size(); i++)
- {
- delegate.unread(expressionList.get(i));
- }
- delegate.unread(c2);
- return c1;
- }
- else
- {
- //EL expression found. Evaluate it and pushback
- //the result into the stream
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- try
- {
- ValueExpression ve = context.getApplication().
- getExpressionFactory().createValueExpression(
- elContext,
- "#{"+convertToExpression(expressionList)+"}",
- String.class);
- String value = (String) ve.getValue(elContext);
-
- for (int i = value.length()-1; i >= 0 ; i--)
- {
- delegate.unread((int) value.charAt(i));
- }
- }
- catch(ELException e)
- {
- ExceptionQueuedEventContext equecontext = new ExceptionQueuedEventContext (
- context, e, null);
- context.getApplication().publishEvent (context, ExceptionQueuedEvent.class, equecontext);
-
- Logger log = Logger.getLogger(ResourceImpl.class.getName());
- if (log.isLoggable(Level.SEVERE))
- {
- log.severe("Cannot evaluate EL expression " + convertToExpression(expressionList)
- + " in resource " + (libraryName == null?"":libraryName) + ":" +
- (resourceName == null?"":resourceName));
- }
-
- delegate.unread(c3);
- for (int i = expressionList.size()-1; i >= 0; i--)
- {
- delegate.unread(expressionList.get(i));
- }
- delegate.unread(c2);
- return c1;
- }
-
- //read again
- return delegate.read();
- }
- }
- else
- {
- delegate.unread(c2);
- return c1;
- }
- }
- else
- {
- //just continue
- return c1;
- }
- }
-
- private String convertToExpression(List<Integer> expressionList)
- {
- char[] exprArray = new char[expressionList.size()];
-
- for (int i = 0; i < expressionList.size(); i++)
- {
- exprArray[i] = (char) expressionList.get(i).intValue();
- }
- return String.valueOf(exprArray);
- }
-
- @Override
- public void close() throws IOException
- {
- delegate.close();
- }
-}
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.ExceptionQueuedEventContext;
+
+import org.apache.myfaces.shared.util.io.DynamicPushbackInputStream;
+
+public class ValueExpressionFilterInputStream extends InputStream
+{
+ private PushbackInputStream delegate;
+ private String libraryName;
+ private String resourceName;
+
+ public ValueExpressionFilterInputStream(InputStream in, String libraryName, String resourceName)
+ {
+ super();
+ delegate = new DynamicPushbackInputStream(in,300);
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ int c1 = delegate.read();
+
+ if (c1 == -1)
+ {
+ return -1;
+ }
+
+ if ( ((char)c1) == '#')
+ {
+ int c2 = delegate.read();
+ if (c2 == -1)
+ {
+ return -1;
+ }
+ if (((char)c2) == '{')
+ {
+ //It is a value expression. We need
+ //to look for a occurrence of } to
+ //extract the expression and evaluate it,
+ //the result should be unread.
+ List<Integer> expressionList = new ArrayList<Integer>();
+ int c3 = delegate.read();
+ while ( c3 != -1 && ((char)c3) != '}' )
+ {
+ expressionList.add(c3);
+ c3 = delegate.read();
+ }
+
+ if (c3 == -1)
+ {
+ //get back the data, because we can't
+ //extract any value expression
+ for (int i = 0; i < expressionList.size(); i++)
+ {
+ delegate.unread(expressionList.get(i));
+ }
+ delegate.unread(c2);
+ return c1;
+ }
+ else
+ {
+ //EL expression found. Evaluate it and pushback
+ //the result into the stream
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ try
+ {
+ ValueExpression ve = context.getApplication().
+ getExpressionFactory().createValueExpression(
+ elContext,
+ "#{"+convertToExpression(expressionList)+"}",
+ String.class);
+ String value = (String) ve.getValue(elContext);
+
+ for (int i = value.length()-1; i >= 0 ; i--)
+ {
+ delegate.unread((int) value.charAt(i));
+ }
+ }
+ catch(ELException e)
+ {
+ ExceptionQueuedEventContext equecontext = new ExceptionQueuedEventContext (
+ context, e, null);
+ context.getApplication().publishEvent (context, ExceptionQueuedEvent.class, equecontext);
+
+ Logger log = Logger.getLogger(ResourceImpl.class.getName());
+ if (log.isLoggable(Level.SEVERE))
+ {
+ log.severe("Cannot evaluate EL expression " + convertToExpression(expressionList)
+ + " in resource " + (libraryName == null?"":libraryName) + ":" +
+ (resourceName == null?"":resourceName));
+ }
+
+ delegate.unread(c3);
+ for (int i = expressionList.size()-1; i >= 0; i--)
+ {
+ delegate.unread(expressionList.get(i));
+ }
+ delegate.unread(c2);
+ return c1;
+ }
+
+ //read again
+ return delegate.read();
+ }
+ }
+ else
+ {
+ delegate.unread(c2);
+ return c1;
+ }
+ }
+ else
+ {
+ //just continue
+ return c1;
+ }
+ }
+
+ private String convertToExpression(List<Integer> expressionList)
+ {
+ char[] exprArray = new char[expressionList.size()];
+
+ for (int i = 0; i < expressionList.size(); i++)
+ {
+ exprArray[i] = (char) expressionList.get(i).intValue();
+ }
+ return String.valueOf(exprArray);
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ delegate.close();
+ }
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java?rev=1239850&r1=1239849&r2=1239850&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java Thu Feb 2 21:12:45 2012
@@ -1,154 +1,154 @@
-/*
- * 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.util.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PushbackInputStream;
-
-/**
- * NOTE: Copy of org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
- *
- * PushbackInputStream implementation that performs dynamic resizing of the unread buffer
- */
-public class DynamicPushbackInputStream extends PushbackInputStream
-{
-
- private final int origsize;
-
- public DynamicPushbackInputStream(InputStream in)
- {
- super(in);
- this.origsize = 1;
- }
-
- public DynamicPushbackInputStream(InputStream in, int initialSize)
- {
- super(in, initialSize);
- this.origsize = initialSize;
- }
-
- /**
- * Clear the buffer
- */
- public int clear()
- {
- int m = buf.length;
- buf = new byte[origsize];
- pos = origsize;
- return m;
- }
-
- /**
- * Shrink the buffer. This will reclaim currently unused space in the buffer, reducing memory but potentially
- * increasing the cost of resizing the buffer
- */
- public int shrink()
- {
- byte[] old = buf;
- if (pos == 0)
- {
- return 0; // nothing to do
- }
- int n = old.length - pos;
- int m;
- int p;
- int s;
- int l;
- if (n < origsize)
- {
- buf = new byte[origsize];
- p = pos;
- s = origsize - n;
- l = old.length - p;
- m = old.length - origsize;
- pos = s;
- }
- else
- {
- buf = new byte[n];
- p = pos;
- s = 0;
- l = n;
- m = old.length - l;
- pos = 0;
- }
- System.arraycopy(old, p, buf, s, l);
- return m;
- }
-
- private void resize(int len)
- {
- byte[] old = buf;
- buf = new byte[old.length + len];
- System.arraycopy(old, 0, buf, len, old.length);
- }
-
- public void unread(byte[] b, int off, int len) throws IOException
- {
- if (len > pos && pos + len > buf.length)
- {
- resize(len - pos);
- pos += len - pos;
- }
- super.unread(b, off, len);
- }
-
- public void unread(int b) throws IOException
- {
- if (pos == 0)
- {
- resize(1);
- pos++;
- }
- super.unread(b);
- }
-
- public int read() throws IOException
- {
- int m = super.read();
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return m;
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- this.available(); // workaround for a problem in PushbackInputStream, without this, the amount of bytes read
- // from some streams will be incorrect
- int r = super.read(b, off, len);
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return r;
- }
-
- public long skip(long n) throws IOException
- {
- long r = super.skip(n);
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return r;
- }
-}
+/*
+ * 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.util.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+/**
+ * NOTE: Copy of org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
+ *
+ * PushbackInputStream implementation that performs dynamic resizing of the unread buffer
+ */
+public class DynamicPushbackInputStream extends PushbackInputStream
+{
+
+ private final int origsize;
+
+ public DynamicPushbackInputStream(InputStream in)
+ {
+ super(in);
+ this.origsize = 1;
+ }
+
+ public DynamicPushbackInputStream(InputStream in, int initialSize)
+ {
+ super(in, initialSize);
+ this.origsize = initialSize;
+ }
+
+ /**
+ * Clear the buffer
+ */
+ public int clear()
+ {
+ int m = buf.length;
+ buf = new byte[origsize];
+ pos = origsize;
+ return m;
+ }
+
+ /**
+ * Shrink the buffer. This will reclaim currently unused space in the buffer, reducing memory but potentially
+ * increasing the cost of resizing the buffer
+ */
+ public int shrink()
+ {
+ byte[] old = buf;
+ if (pos == 0)
+ {
+ return 0; // nothing to do
+ }
+ int n = old.length - pos;
+ int m;
+ int p;
+ int s;
+ int l;
+ if (n < origsize)
+ {
+ buf = new byte[origsize];
+ p = pos;
+ s = origsize - n;
+ l = old.length - p;
+ m = old.length - origsize;
+ pos = s;
+ }
+ else
+ {
+ buf = new byte[n];
+ p = pos;
+ s = 0;
+ l = n;
+ m = old.length - l;
+ pos = 0;
+ }
+ System.arraycopy(old, p, buf, s, l);
+ return m;
+ }
+
+ private void resize(int len)
+ {
+ byte[] old = buf;
+ buf = new byte[old.length + len];
+ System.arraycopy(old, 0, buf, len, old.length);
+ }
+
+ public void unread(byte[] b, int off, int len) throws IOException
+ {
+ if (len > pos && pos + len > buf.length)
+ {
+ resize(len - pos);
+ pos += len - pos;
+ }
+ super.unread(b, off, len);
+ }
+
+ public void unread(int b) throws IOException
+ {
+ if (pos == 0)
+ {
+ resize(1);
+ pos++;
+ }
+ super.unread(b);
+ }
+
+ public int read() throws IOException
+ {
+ int m = super.read();
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return m;
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ this.available(); // workaround for a problem in PushbackInputStream, without this, the amount of bytes read
+ // from some streams will be incorrect
+ int r = super.read(b, off, len);
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return r;
+ }
+
+ public long skip(long n) throws IOException
+ {
+ long r = super.skip(n);
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return r;
+ }
+}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/resources/META-INF/myfaces-metadata.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/resources/META-INF/myfaces-metadata.xml?rev=1239850&r1=1239849&r2=1239850&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/resources/META-INF/myfaces-metadata.xml (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/resources/META-INF/myfaces-metadata.xml Thu Feb 2 21:12:45 2012
@@ -7687,7 +7687,7 @@ Furthermore, the init parameter only wor
<webConfigParam>
<name>org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED</name>
<fieldName>CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE</fieldName>
- <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().</desc>
+ <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().</desc>
<longDesc>Enable or disable a cache used to "remember" if a view exists or not and reduce the impact of
sucesive calls to ExternalContext.getResource().</longDesc>
<defaultValue>true</defaultValue>
@@ -8079,8 +8079,8 @@ operation</desc>
<longDesc>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).</longDesc>
+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).</longDesc>
<defaultValue>false</defaultValue>
<expectedValues>true, false</expectedValues>
<sourceClassName>org.apache.myfaces.shared.config.MyfacesConfig</sourceClassName>
@@ -8089,14 +8089,19 @@ set this param to false (default false).
<webConfigParam>
<name>org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER</name>
<fieldName>INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER</fieldName>
- <desc>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
+ <desc>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</desc>
- <longDesc>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
+ <longDesc>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).</longDesc>
+To ensure strict compatibility with the spec set this param to true (by default is false,
+so the change is enabled by default).</longDesc>
<defaultValue>false</defaultValue>
<expectedValues>true, false</expectedValues>
<sourceClassName>org.apache.myfaces.shared.config.MyfacesConfig</sourceClassName>