Package org.apache.struts2.util.fs
Class DefaultFileManager
java.lang.Object
org.apache.struts2.util.fs.DefaultFileManager
- All Implemented Interfaces:
FileManager
- Direct Known Subclasses:
JBossFileManager
Default implementation of
FileManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
fileNeedsReloading
(String fileName) Checks if given file changed and must be reloadedboolean
fileNeedsReloading
(URL fileUrl) Checks if file represented by provided URL changed and must be reloadedCollection<? extends URL>
getAllPhysicalUrls
(URL url) boolean
internal()
User's implementation should return false as then it will be taken in first placeprotected boolean
Check if given URL is matching Jar pattern for different serversLoads opens the named file and returns the InputStreamvoid
monitorFile
(URL fileUrl) Adds file to list of monitored filesConvert URLs to URLs with "file" protocolvoid
setReloadingConfigs
(boolean reloadingConfigs) Enables configs reloading when config file changedboolean
support()
Indicate if given implementation supports current OS File System
-
Field Details
-
files
-
reloadingConfigs
protected boolean reloadingConfigs
-
-
Constructor Details
-
DefaultFileManager
public DefaultFileManager()
-
-
Method Details
-
setReloadingConfigs
public void setReloadingConfigs(boolean reloadingConfigs) Description copied from interface:FileManager
Enables configs reloading when config file changed- Specified by:
setReloadingConfigs
in interfaceFileManager
- Parameters:
reloadingConfigs
-StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD
-
fileNeedsReloading
Description copied from interface:FileManager
Checks if file represented by provided URL changed and must be reloaded- Specified by:
fileNeedsReloading
in interfaceFileManager
- Parameters:
fileUrl
- url to a file- Returns:
- true if file exists and should be reloaded, if url is null return false
-
fileNeedsReloading
Description copied from interface:FileManager
Checks if given file changed and must be reloaded- Specified by:
fileNeedsReloading
in interfaceFileManager
- Parameters:
fileName
- to check- Returns:
- true if file changed
-
loadFile
Description copied from interface:FileManager
Loads opens the named file and returns the InputStream- Specified by:
loadFile
in interfaceFileManager
- Parameters:
fileUrl
- - the URL of the file to open- Returns:
- an InputStream of the file contents or null
-
monitorFile
Description copied from interface:FileManager
Adds file to list of monitored files- Specified by:
monitorFile
in interfaceFileManager
- Parameters:
fileUrl
-URL
to file to be monitored
-
isJarURL
Check if given URL is matching Jar pattern for different servers- Parameters:
fileUrl
- jar file URL- Returns:
- if given URL is matching Jar pattern for different servers
-
normalizeToFileProtocol
Description copied from interface:FileManager
Convert URLs to URLs with "file" protocol- Specified by:
normalizeToFileProtocol
in interfaceFileManager
- Parameters:
url
- URL to convert to a jar url- Returns:
- a URL to a file, or null if the URL external form cannot be parsed
-
support
public boolean support()Description copied from interface:FileManager
Indicate if given implementation supports current OS File System- Specified by:
support
in interfaceFileManager
- Returns:
- true if supports current OS File System
-
internal
public boolean internal()Description copied from interface:FileManager
User's implementation should return false as then it will be taken in first place- Specified by:
internal
in interfaceFileManager
- Returns:
- true if it's a framework provided implementation
-
getAllPhysicalUrls
- Specified by:
getAllPhysicalUrls
in interfaceFileManager
- Throws:
IOException
-