[richfaces-issues] [JBoss JIRA] (RF-11992) cache bug in portlet

Ivan Ravin (JIRA) jira-events at lists.jboss.org
Sat Oct 13 11:12:01 EDT 2012


    [ https://issues.jboss.org/browse/RF-11992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726214#comment-12726214 ] 

Ivan Ravin commented on RF-11992:
---------------------------------

Brian, your solution does nothing with real response, because in portal environment richfaces works with copy of headers map. You remove wrong key/value from copy, but in real headers map it still persists.
This is code from org.exoplatform.portal.application.PortalRequestContext where headers key/values finally falls:
{code:title=org.exoplatform.portal.application.PortalRequestContext.java|borderStyle=solid}
...
   // in this case headers is map from AbstractCacheableResource, without Pragma header,
   // and response_ is real HttpServletResponse, where Pragma no-cache already set
   public void setHeaders(Map<String, String> headers)
   {
      Set<String> keys = headers.keySet();
      for (Iterator<String> iter = keys.iterator(); iter.hasNext();)
      {
         String key = iter.next();
         response_.setHeader(key, headers.get(key));
      }
   }
{code}
As you can see, this does nothing with Pragma no-cache when this header not present in RF response and already present in real response. My suggestion was to put empty Pragma header to RF response.
Your solution will work only if we'll make same changes not only in RF, but in portal code too.

In Jboss Portal 2.7.2 situation is worst, and even my solution will not work:

{code:title=org.jboss.portal.core.controller.handler.HTTPResponse.java|borderStyle=solid}
...
    if (properties != null)
    {
        for (String key: properties.keySet())
        {
            if (properties.getValue(key) != null)
            {
                resp.addHeader(key, properties.getValue(key)); //!!!! :(
            }
        }
    }
{code}



                
> cache bug in portlet
> --------------------
>
>                 Key: RF-11992
>                 URL: https://issues.jboss.org/browse/RF-11992
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: core
>    Affects Versions: 3.3.3.Final, 4.2.0.CR1
>         Environment: jboss portal 2.7.2; Gatein portal
>            Reporter: Ivan Ravin
>            Assignee: Ken Finnigan
>            Priority: Minor
>             Fix For: 4.3.0.M2
>
>
> On Jboss and Gatein portal richfaces cant be cached when user is logged in.
> Bug is found for richfaces 3.3.3 but i think can be reproduced for 4.x because org.richfaces.resource.AbstractCacheableResource has similar code.
> The steps for reproduce bug are:
>     download portlet bridge 2.2 archive
>     deploy richFacesPortlet.war from portlet bridge archive (i used jboss portal 2.7.2 bundle and GateIn-3.1.0-FINAL-jbossas)
>     look at network activity (i did with firefox + firebug, the same result on any other browser). Just open page with richfaces portlet.
> When user is not logged in, all richfaces resources are caching well, and this is headers returned by server:
> |Cache-Control	|max-age=86400|
> |Content-Type	|text/javascript|
> |Date	|Thu, 26 Jan 2012 17:57:39 GMT|
> |Expires	|27 Jan 2012 17:57:39 GMT|
> |Last-Modified	|26 Jan 2012 17:42:17 GMT|
> |Server	|Apache-Coyote/1.1|
> |X-Powered-By	|Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0|
> But when user is logged in all richfaces stuff come from network every time (more than 1.3 mb).
> This is headers returned by portal 2.7.2 when user logged in:
> |Cache-Control	|{color:red}no-cache,{color} max-age=86400|
> |Content-Type	|text/javascript|
> |Date	|Thu, 26 Jan 2012 18:26:49 GMT|
> |Expires	|{color:red}Thu, 01 Jan 1970 03:00:00 MSK,{color} 27 Jan 2012 18:26:49 GMT|
> |Last-Modified	|26 Jan 2012 18:05:56 GMT|
> |{color:red}Pragma{color}	|{color:red}No-cache{color}|
> |Server	|Apache-Coyote/1.1|
> |Transfer-Encoding	|chunked|
> |X-Powered-By	|Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0|
> 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|
> |{color:red}Pragma{color}	|{color:red}No-cache{color}|
> |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 richfaces create good headers, but there is some code in portal which put wrong values into real response before richfaces. I cant find this code in portal sources, so maybe it is JBoss AS problem, or third party component.
> In Gatein portal problem was partially resolved: it overwrites 2 wrong headers with values provided by richfaces, but "pragma" header is absent in richfaces response, and this way in secured portlets richfaces generate too much unnesessary traffic.
> To solve problem for GateIn there is enough to provide empty Pragma header; To solve problem for JBoss Portal its required to fix resource headers processing in portal code, like it done in gatein.

--
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


More information about the richfaces-issues mailing list