Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MYFACES-3672 TODO 'optimize this code' in ResourceHandlerImpl.isResou…

…rceIdentifierExcluded() (Thanks to dennis hoersch for provide this patch)

git-svn-id: https://svn.apache.org/repos/asf/myfaces/core/trunk@1433542 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 6ebed8b9fcd08aa985862af2712415549b86bb91 1 parent d7fd2ea
Leonardo Uribe authored
View
22 impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
@@ -87,6 +87,8 @@
private Boolean _allowSlashLibraryName;
private int _resourceBufferSize = -1;
+
+ private String[] _excludedResourceExtensions;
@Override
public Resource createResource(String resourceName)
@@ -542,20 +544,20 @@ protected String getLocalePrefixForLocateResource()
return localePrefix;
}
- protected boolean isResourceIdentifierExcluded(FacesContext context,
- String resourceIdentifier)
+ protected boolean isResourceIdentifierExcluded(FacesContext context, String resourceIdentifier)
{
- String value = context.getExternalContext().getInitParameter(
- RESOURCE_EXCLUDES_PARAM_NAME);
- if (value == null)
+ if (_excludedResourceExtensions == null)
{
- value = RESOURCE_EXCLUDES_DEFAULT_VALUE;
+ String value = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(),
+ RESOURCE_EXCLUDES_PARAM_NAME,
+ RESOURCE_EXCLUDES_DEFAULT_VALUE);
+
+ _excludedResourceExtensions = StringUtils.splitShortString(value, ' ');
}
- //TODO: optimize this code
- String[] extensions = StringUtils.splitShortString(value, ' ');
- for (int i = 0; i < extensions.length; i++)
+
+ for (int i = 0; i < _excludedResourceExtensions.length; i++)
{
- if (resourceIdentifier.endsWith(extensions[i]))
+ if (resourceIdentifier.endsWith(_excludedResourceExtensions[i]))
{
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.