dennis hoersch created MYFACES-3722:
---------------------------------------
Summary: Cache for ResourceHandlerImpl.isResourceRequest seams not
to work in 'none resource requests'
Key: MYFACES-3722
URL: https://issues.apache.org/jira/browse/MYFACES-3722
Project: MyFaces Core
Issue Type: Bug
Affects Versions: 2.1.11
Reporter: dennis hoersch
There is a cache for the calculated result whether the given request is a
resource request.
I think it is not working as expected in the moment.
ResourceHandlerImpl:
@Override
public boolean isResourceRequest(FacesContext facesContext)
{
// Since this method could be called many times we save it
//on request map so the first time is calculated it remains
//alive until the end of the request
Boolean value = (Boolean)
facesContext.getAttributes().get(IS_RESOURCE_REQUEST);
if (value != null && value)
{
//return the saved value
return value;
}
else
{
String resourceBasePath = getResourceHandlerSupport()
.calculateResourceBasePath(facesContext);
if (resourceBasePath != null
&&
resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER))
{
facesContext.getAttributes().put(IS_RESOURCE_REQUEST,
Boolean.TRUE);
return true;
}
else
{
facesContext.getAttributes().put(IS_RESOURCE_REQUEST,
Boolean.FALSE);
return false;
}
}
}
In case of IS_RESOURCE_REQUEST=false the value is recalculated for every method
call again because of the 'if (value != null && value)'. I think it just should
be 'if (value != null)', or?
----
(
@Override
public boolean isResourceRequest(FacesContext facesContext)
{
// Since this method could be called many times we save it
// on request map so the first time is calculated it remains
// alive until the end of the request
Boolean value = (Boolean)
facesContext.getAttributes().get(IS_RESOURCE_REQUEST);
if (value == null)
{
String resourceBasePath = getResourceHandlerSupport()
.calculateResourceBasePath(facesContext);
value = resourceBasePath != null
&&
resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER);
facesContext.getAttributes().put(IS_RESOURCE_REQUEST, value);
}
return value;
}
)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira