Package org.apache.myfaces.resource
Class TempDirFileCacheResourceLoader
- java.lang.Object
-
- org.apache.myfaces.resource.ResourceLoader
-
- org.apache.myfaces.resource.ResourceLoaderWrapper
-
- 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
Nested Classes Modifier and Type Class Description static class
TempDirFileCacheResourceLoader.FileProducer
-
Nested classes/interfaces inherited from class org.apache.myfaces.resource.ResourceLoader
ResourceLoader.VersionComparator
-
-
Field Summary
Fields Modifier and Type Field Description 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.resource.ResourceLoader
VERSION_INVALID
-
-
Constructor Summary
Constructors Constructor Description TempDirFileCacheResourceLoader(ResourceLoader delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Return the max available version found (if exists) or return null if no version available.ResourceLoader
getWrapped()
protected void
initialize()
static boolean
isValidCreateTemporalFiles(FacesContext facesContext)
-
Methods inherited from class org.apache.myfaces.resource.ResourceLoaderWrapper
createResourceMeta, getLibraryVersion, getPrefix, getResourceVersion, getVersionComparator, iterator, libraryExists, resourceExists, setPrefix, setVersionComparator
-
Methods inherited from class org.apache.myfaces.resource.ResourceLoader
createResourceMeta
-
-
-
-
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)
Description copied from class:ResourceLoader
Return the max available version found (if exists) or return null if no version available.- Overrides:
getResourceURL
in classResourceLoaderWrapper
-
getResourceInputStream
public InputStream getResourceInputStream(ResourceMeta resourceMeta, Resource resource)
-
getResourceInputStream
public InputStream getResourceInputStream(ResourceMeta resourceMeta)
- Overrides:
getResourceInputStream
in classResourceLoaderWrapper
-
createTemporalFileVersion
protected void createTemporalFileVersion(FacesContext facesContext, ResourceMeta resourceMeta, File target)
-
getResourceBufferSize
protected int getResourceBufferSize()
-
getWrapped
public ResourceLoader getWrapped()
-
-