MyFaces ResourceImpl$ValueExpressionFilterInputStream does not handle resolving
long URLs
-----------------------------------------------------------------------------------------
Key: MYFACES-3414
URL: https://issues.apache.org/jira/browse/MYFACES-3414
Project: MyFaces Core
Issue Type: Bug
Components: General
Affects Versions: 2.1.4, 2.1.3
Reporter: Deryk Sinotte
Priority: Critical
We have logged an issue in our own JIRA tracker for this issue as well:
http://jira.icefaces.org/browse/ICE-7518
It was discovered running on Liferay but the issue turn out to be not specific
to portlets - it's simply manifest more obviously there. Given a CSS file with
an EL resource such as:
url("#{resource['icefaces.ace:themes/sam/images/ui-default.png']}")
MyFaces will typically return something like:
url("/my/javax.faces.resource/themes/sam/images/ui-default.png.jsf?ln=icefaces.ace")
When running on Liferay, the returned URL will be much longer given the portlet
namespacing and the various Liferay request parameters:
url("http://localhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")
However, the URL that is actually written into our CSS file looks like this:
url("lhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")
The URL is missing characters at the front
lhost:8080/web
instead of
http://localhost:8080/web
Almost all the resource URLs in our CSS file are mangled in a similar way.
After a lot of head scratching, it turns out that the URLs are longer than
ResourceImpl$ValueExpressionFilterInputStream is prepared to handle:
private class ValueExpressionFilterInputStream extends InputStream
{
private PushbackInputStream delegate;
public ValueExpressionFilterInputStream(InputStream in)
{
super();
delegate = new PushbackInputStream(in,255);
}
...
For us, setting the "unread" buffer to a higher number than 255 appears to
solve the issue. Perhaps this could be done a different way to account for
longer URLs or at least made configurable if someone needs to adjust it.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira