3 Replies Latest reply on Mar 30, 2006 4:47 PM by inscribe

    Content caching

    inscribe

      Hi,

      Not sure if this post should go in this forum or not but since my application is using JBoss Portal I'll post here.

      Versions:
      JBoss AS4.0.3SP1
      JBoss Portal 2.2.1-RC2
      Firefox 1.5
      IE 6.0

      Symptoms:
      I have a JSP and a servlet that displays binary data (images) retrieved from a database. The JSP contains an img tag that has the source set to point at the servlet.

      <img name="uniqueName" id="uniqueName" src="servletURL" />
      

      When I retrieve and display the first image thinks are ok. I then retrieve and display another image and the first image is displayed until I hit F5 to refresh the page in the browser.

      What I have tried:
      In the JSP:
      response.setHeader("Cache-Control","no-cache");
      response.setHeader("Pragma","no-cache");
      response.setDateHeader("Expires", 0);
      giving the image a uniqueName

      In context.xml of:
      jboss-portal.sar\portal-server.war\WEB-INF
      jbossweb-tomcat55.sar
      myApplication.war\WEB-INF

      <Context cachingAllowed="false">
      </Context>
      


      Can anyone help me with this caching problem? I don't know what else to try.

      Thanks.

        • 1. Re: Content caching
          inscribe

          Bump

          • 2. Re: Content caching
            ivanlatysh

            From your story I can see that it is not server cache, it is client caching issue.

            A simple solution is to add some parameter to url, most of the time it will work, but not always.

            for example:

            <img name="uniqueName" id="uniqueName" src="http://server.com/servletURL?bla=bla" />


            P.S. If you are using MSIE as a browser it will cache content regardless of your settings. Switch to Firefox.

            • 3. Re: Content caching
              inscribe

              Hi,

              Thanks for that. I worked it out late yesterday. I had a breakpoint on the servlet and on the second call to the page it never called the servlet. I added the uniqueID to the servlet querystring and hey presto it worked.

              P.S We are using firefox :) I just added IE in there as it happened to produce the same results.