-
1. Re: Caching resource bug
kenfinni Jan 27, 2012 3:44 PM (in response to ivan_ra)I don't think I've seen anything like that occur before.
Can you try the PortletBridge with GateIn instead of JBoss Portal, as it may be related to the Portal Container as opposed to the PortletBridge?
Ken
-
2. Re: Caching resource bug
ivan_ra Jan 28, 2012 4:48 AM (in response to kenfinni)The same problem with GateIn-3.1.0-FINAL-jbossas bundle, but now only one wrong header:
Cache-Control max-age=86400
Content-Type text/javascript;charset=UTF-8
Date Sat, 28 Jan 2012 08:54:14 GMT
Expires 29 Jan 2012 08:54:14 GMT
Last-Modified 28 Jan 2012 08:51:11 GMT
Pragma No-cache
Server Apache-Coyote/1.1
Transfer-Encoding chunked
X-Powered-By Servlet 2.5; JBoss-5.0/JBossWeb-2.1
This header (Pragma) appears only when user is logged in, and again, all richfaces resources come through network.
I did some debug and found that bridge create good headers, but someone put wrong values into real response before it. I cant find this code in portal sources, so maybe it is JBoss AS problem, or third party component.
Wrong headers appears only when user is logged in.
Cant find root of problem, but can correct real response
I've made patch for portal-core-lib.jar (2.7.2) which work for me:
class org.jboss.portal.core.controller.handler.HTTPResponse has 2 methods sendBinary(...) with inner anonymous classes with code like this:
if (properties != null)
{
for (String key: properties.keySet())
{
if (properties.getValue(key) != null)
{
resp.addHeader(key, properties.getValue(key));
}
}
}the patch for this code is:
if (properties != null)
{
for (String key: properties.keySet())
{
if (properties.getValue(key) != null)
{
resp.setHeader(key, properties.getValue(key));
}
}
String key = "Pragma";
resp.setHeader(key, properties.getValue(key));
}I think the same patch available for gatein portal too
-
3. Re: Caching resource bug
ivan_ra Jan 30, 2012 2:02 PM (in response to ivan_ra)I looked for gatein sources and found that same headers workaround already made.
This is code from org.exoplatform.portal.webui.application.UIPortletActionListener$ServeResourceActionListener:
//
//Manage headers
if (piResponse.getProperties() != null && piResponse.getProperties().getTransportHeaders() != null)
{
MultiValuedPropertyMap transportHeaders = piResponse.getProperties().getTransportHeaders();
Map headers = new HashMap();
for (String key : transportHeaders.keySet())
{
for (String value : transportHeaders.getValues(key))
{
headers.put(key, value);
}
}
context.setHeaders(headers);
}By this way gatein overwrites all headers using transportHeaders values, as i suggested for jboss portal 2.7.2. The only problem is Pragma=No-cache header.
So, i suggest another workaround (now for richfaces). Richfaces must set empty pragma for transportHeaders in method
org.ajax4jsf.resource.InternetResourceBase.sendHeaders(ResourceContext context): add this string
if (cached) {
...
context.setHeader("Pragma", "");
}
After richfaces patching gatein portal working well, jboss portal still needs for patch like this:
if (properties != null)
{
for (String key: properties.keySet())
{
if (properties.getValue(key) != null)
{
resp.setHeader(key, properties.getValue(key));
}
}
}Now, i think it's completly richfaces bug and workaround (+jboss for legacy projects). Should i have to make new topic in richfaces forum or its possible to move it there?
-
4. Re: Caching resource bug
kenfinni Jan 31, 2012 9:38 AM (in response to ivan_ra)It might be best to simply create a new forum thread in RichFaces so as not to confuse them with Portal details, as it now sounds like your problem is purely related to RichFaces.
Ken