_resourceBase=Resource.newResource(_context.getResource(URIUtil.SLASH)).addPath(rrb);
}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
throw new UnavailableException(e.toString());
}
}
String rb=getInitParameter("resourceBase");
if (rrb != null && rb != null)
throw new UnavailableException("resourceBase & relativeResourceBase");
if (rb!=null)
{
try{_resourceBase=Resource.newResource(rb);}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
throw new UnavailableException(e.toString());
}
}
String t=getInitParameter("cacheControl");
if (t!=null)
_cacheControl=new ByteArrayBuffer(t);
try
{
if (_resourceBase==null)
_resourceBase=Resource.newResource(_context.getResource(URIUtil.SLASH));
String cache_type =getInitParameter("cacheType");
int max_cache_size=getInitInt("maxCacheSize", -2);
int max_cached_file_size=getInitInt("maxCachedFileSize", -2);
int max_cached_files=getInitInt("maxCachedFiles", -2);
if (cache_type==null || "nio".equals(cache_type)|| "both".equals(cache_type))
{
if (max_cache_size==-2 || max_cache_size>0)
{
_nioCache=new NIOResourceCache(_mimeTypes);
if (max_cache_size>0)
_nioCache.setMaxCacheSize(max_cache_size);
if (max_cached_file_size>=-1)
_nioCache.setMaxCachedFileSize(max_cached_file_size);
if (max_cached_files>=-1)
_nioCache.setMaxCachedFiles(max_cached_files);
_nioCache.start();
}
}
if ("bio".equals(cache_type)|| "both".equals(cache_type))
{
if (max_cache_size==-2 || max_cache_size>0)
{
_bioCache=new ResourceCache(_mimeTypes);
if (max_cache_size>0)
_bioCache.setMaxCacheSize(max_cache_size);
if (max_cached_file_size>=-1)
_bioCache.setMaxCachedFileSize(max_cached_file_size);
if (max_cached_files>=-1)
_bioCache.setMaxCachedFiles(max_cached_files);
_bioCache.start();
}
}
if (_nioCache==null)
_bioCache=null;
}
catch (Exception e)
{
Log.warn(Log.EXCEPTION,e);
throw new UnavailableException(e.toString());
}
if (Log.isDebugEnabled()) Log.debug("resource base = "+_resourceBase);
}