Version: 1.1.1

org.biomoby.client
Class ServletFileCache

java.lang.Object
  extended by org.biomoby.client.FileCache
      extended by org.biomoby.client.ServletFileCache
All Implemented Interfaces:
SimpleCache, SimpleFileCache

public class ServletFileCache
extends FileCache

A simple cache implementation meant to be used in a servlet environment in order to save and later return (any) data, or to find that the given data are not available in the cache. It uses files to store data.

Version:
$Id: ServletFileCache.java,v 1.4 2005/04/07 16:37:02 kawas Exp $
Author:
Martin Senger

Constructor Summary
ServletFileCache(javax.servlet.ServletContext context, String contextPath)
          Constructor specifying a context of the calling servlet.
 
Method Summary
 String getURL(String id)
          Return a full URL of the cached object 'id'.
 
Methods inherited from class org.biomoby.client.FileCache
createId, existsInCache, getContents, getFilename, removeFromCache, removeOlderThen, setContents, setContents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletFileCache

public ServletFileCache(javax.servlet.ServletContext context,
                        String contextPath)
Constructor specifying a context of the calling servlet. Use this constructor if you wish (and if your servlet has proper write permissions) to store the cached objects in files created in the directory specified by this servlet context (which usually mean that the files will be created in directory
 /webapps//cache/
 
The not existing directories (for example the last 'cache' directory) will be created for you. The 'contextPath' is a path (relative to the servlet context) where the cached files will be created (actually starting from here, because they may be created in a deeper directory structure. Usually you get it in the calling servlet from the request by method request.getContextPath(). The 'contextPath' starts with a "/" character but does not end with a "/" character.

Method Detail

getURL

public String getURL(String id)
Return a full URL of the cached object 'id'.

Specified by:
getURL in interface SimpleFileCache
Overrides:
getURL in class FileCache
Parameters:
id - a unique ID

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010