Dashboard > Community Wiki > ... > Developing with Magnolia > Caching
Caching Log In View a printable version of the current page.

Added by GrĂ©gory Joseph , last edited by Boris Kraft on Jun 23, 2008  (view change)
Labels: 

All web browsers support client side caching but this caching does not differentiate between various MIME types, so if you set your browser to cache content you might have problems with text information which needs to be updated on every request.

"Browser specification states that the browser should first check to see if there's a new version on the server. If there have been no changes, it should use the version that's cached (by the browser). The "no-cache" directive is supposed to tell the browser not to bother checking, but go ahead and download the resource again."

Now -

With current implementation of Magnolia you can write a very small "Filter" or a servlet which extends "EntryServlet"

there you can check the headers sent by the browser to find out if Magnolia need to render image or file again.

here is an example servlet

import java.io.File; 
import com.obinary.cms.core.PathUtil; 

public class MyIntelligentServlet extends EntryServlet { 
  public long getLastModified(HttpServletRequest req) { 
    String path = PathUtil.getCacheDirectoryPath()+req.getRequestURI(); 
    return new File(path).lastModified(); 
  } 
}

That's it, configure it in web.xml instead of EntryServlet

Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators