org.apache.myfaces.resource
Class TempDirFileCacheResourceLoader

java.lang.Object
  extended by org.apache.myfaces.shared.resource.ResourceLoader
      extended by org.apache.myfaces.shared.resource.ResourceLoaderWrapper
          extended by org.apache.myfaces.resource.TempDirFileCacheResourceLoader
All Implemented Interfaces:
FacesWrapper<ResourceLoader>

public class TempDirFileCacheResourceLoader
extends ResourceLoaderWrapper

ResourceLoader that uses a temporal folder to cache resources, avoiding the problem described on MYFACES-3586 (Performance improvement in Resource loading - HIGH CPU inflating bytes in ResourceHandlerImpl.handleResourceRequest).

Author:
Leonardo Uribe

Nested Class Summary
static class TempDirFileCacheResourceLoader.FileProducer
           
 
Nested classes/interfaces inherited from class org.apache.myfaces.shared.resource.ResourceLoader
ResourceLoader.VersionComparator
 
Field Summary
static String INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED
          If this param is set to true (default false), a temporal directory is created and all files handled by this ResourceLoader are cached there, avoiding the problem described on MYFACES-3586.
static boolean INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED_DEFAULT
           
static String TEMP_FILES_LOCK_MAP
           
 
Fields inherited from class org.apache.myfaces.shared.resource.ResourceLoader
VERSION_INVALID
 
Constructor Summary
TempDirFileCacheResourceLoader(ResourceLoader delegate)
           
 
Method Summary
protected  void createTemporalFileVersion(FacesContext facesContext, ResourceMeta resourceMeta, File target)
           
protected  int getResourceBufferSize()
           
 InputStream getResourceInputStream(ResourceMeta resourceMeta)
           
 InputStream getResourceInputStream(ResourceMeta resourceMeta, Resource resource)
           
 URL getResourceURL(ResourceMeta resourceMeta)
           
 ResourceLoader getWrapped()
           
protected  void initialize()
           
static boolean isValidCreateTemporalFiles(FacesContext facesContext)
           
 boolean resourceExists(ResourceMeta resourceMeta)
           
 
Methods inherited from class org.apache.myfaces.shared.resource.ResourceLoaderWrapper
createResourceMeta, getLibraryVersion, getPrefix, getResourceVersion, getVersionComparator, libraryExists, setPrefix, setVersionComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED

@JSFWebConfigParam(since="2.1.11",
                   expectedValues="true, false",
                   defaultValue="false")
public static final String INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED
If this param is set to true (default false), a temporal directory is created and all files handled by this ResourceLoader are cached there, avoiding the problem described on MYFACES-3586. (Performance improvement in Resource loading - HIGH CPU inflating bytes in ResourceHandlerImpl.handleResourceRequest).

See Also:
Constant Field Values

INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED_DEFAULT

public static final boolean INIT_PARAM_TEMPORAL_RESOURCEHANDLER_CACHE_ENABLED_DEFAULT
See Also:
Constant Field Values

TEMP_FILES_LOCK_MAP

public static final String TEMP_FILES_LOCK_MAP
See Also:
Constant Field Values
Constructor Detail

TempDirFileCacheResourceLoader

public TempDirFileCacheResourceLoader(ResourceLoader delegate)
Method Detail

isValidCreateTemporalFiles

public static boolean isValidCreateTemporalFiles(FacesContext facesContext)

initialize

protected void initialize()

getResourceURL

public URL getResourceURL(ResourceMeta resourceMeta)
Overrides:
getResourceURL in class ResourceLoaderWrapper

getResourceInputStream

public InputStream getResourceInputStream(ResourceMeta resourceMeta,
                                          Resource resource)

getResourceInputStream

public InputStream getResourceInputStream(ResourceMeta resourceMeta)
Overrides:
getResourceInputStream in class ResourceLoaderWrapper

resourceExists

public boolean resourceExists(ResourceMeta resourceMeta)
Overrides:
resourceExists in class ResourceLoaderWrapper

createTemporalFileVersion

protected void createTemporalFileVersion(FacesContext facesContext,
                                         ResourceMeta resourceMeta,
                                         File target)

getResourceBufferSize

protected int getResourceBufferSize()

getWrapped

public ResourceLoader getWrapped()


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.