1 Reply Latest reply on Aug 22, 2010 9:39 PM by Kishore Chintoju

    How to remove jsessionid from .xcss includes in richfaces

    Kishore Chintoju Newbie

      Hi Guys

      In all our JSF pages richfaces puts following script and css includes at the very top of the page.

      <script src="/our-web-app/a4j/g/3_3_2.SR1/org/ajax4jsf/framework.pack.js" type="text/javascript"></script>
      <script src="/our-web-app/a4j/g/3_3_2.SR1/org/richfaces/ui.pack.js" type="text/javascript"></script>
      <link class="component" href="/our-web-app/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=19AF453B9E8306206B97A688B421AF29" rel="stylesheet" type="text/css" />
      <link class="component" href="/our-web-app/a4j/s/3_3_2.SR1org/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=19AF453B9E8306206B97A688B421AF29" media="rich-extended-skinning" rel="stylesheet" type="text/css" />
      <link class="component" href="/our-web-app/a4j/s/3_3_2.SR1/org/richfaces/skin.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=19AF453B9E8306206B97A688B421AF29" rel="stylesheet" type="text/css" />
      <script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>

      Richfaces adds a caching header's in the response to cache them for a day. This works fine for all the JS includes and they cached for a day.

      But for all '.xcss' includes, richfaces adds a 'jsessionid' at the end which makes them look like a new URI to the browser on each login, so they only get cached per session or long as the jsessionid is valid.

      Is there any configuration option which we can use to make RichFaces not insert jsessionid in the CSS includes.

      NOTE: We don't use cookies and use jsessionid for session management.

      Version Info:
      Seam Version - 2.1.1.GA
      RichFaces Version - 3.3.2.SR1

      Any help would greatly appreciated..

        • 1. Re: How to remove jsessionid from .xcss includes in richfaces
          Kishore Chintoju Newbie

          Ok, a late post. But might help anyone still looking for this.


          I raised this issue with jboss support as we have jboss developer support center. And below is their answer verbatim.


          (NOTE: The replies themsevles are old


          Reply 1(10/30/2009                     10:10 AM EDT)


          There appears to be no configuration option for this.

          One  approach to solving the problem is to extract the xcss files from the  richfaces jar files and reference them manually.  This would require the  modification of the components xml:


          The  down side to this is ALL style sheets will no longer be included  automatically and will need to be specified manually.  Not entirely  desirable.


          Reply 2 (11/11/2009                     3:01 PM EST)



          There is no configuration option available at this time. The template css is designed as a "session aware" resource.

          If  you use the "NONE" loading strategy for your scripts and styles. You  can write a custom Seam filter to set the expiration time at the http  header as Richfaces filter does for its resources.

          Here is a simple example just to give you an idea.

          public class MySeamFilter extends AbstractFilter {
          private static long DEFAULT_EXPIRE = 1000L * 60L * 60L * 24L;
          public void doFilter(final ServletRequest request, final ServletResponse
          response,final FilterChain chain) throws IOException,ServletException {
          HttpServletResponse res = (HttpServletResponse) response; 
          String requestUri = req.getRequestURI();

          if(requestUri.endsWith(".css") || requestUri.endsWith(".js") ) {
          long ifModifiedSince = req.getDateHeader("If-Modified-Since");
          if (ifModifiedSince >= 0) {               
          else {//the first time to set the header
          chain.doFilter(request, response);