Class AbstractFileConfigFileLoader
java.lang.Object
org.mapfish.print.servlet.fileloader.AbstractFileConfigFileLoader
- All Implemented Interfaces:
ConfigFileLoaderPlugin
- Direct Known Subclasses:
FileConfigFileLoader,ServletConfigFileLoader
Abstract implementation for files that are on the local file system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanisAccessible(URI fileURI) Check if the configuration File exists.final booleanisAccessible(URI configFileUri, String pathToSubResource) check if the file exists and can be accessed by the user/template/config/etc...lastModified(URI fileURI) return the last modified time of the file URI.final byte[]Load the config data.final byte[]Load the file related to the configuration file.protected static FileplatformIndependentUriToFile(URI fileURI) Convert a url to a file object.resolveFiles(URI fileURI) Load the files referenced by the id (in the case of a classpath uri it could references several files, although normally it will only reference one).Return the file object the uri refers to if it refers to a file.Return the file object the uri refers to if it refers to a file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mapfish.print.servlet.fileloader.ConfigFileLoaderPlugin
getUriScheme
-
Constructor Details
-
AbstractFileConfigFileLoader
public AbstractFileConfigFileLoader()
-
-
Method Details
-
platformIndependentUriToFile
Convert a url to a file object. No checks are made to see if file exists but there are some hacks that are needed to convert uris to files across platforms.- Parameters:
fileURI- the uri to convert
-
resolveFiles
Load the files referenced by the id (in the case of a classpath uri it could references several files, although normally it will only reference one).- Parameters:
fileURI- the uri identifying the config file.
-
toFile
Description copied from interface:ConfigFileLoaderPluginReturn the file object the uri refers to if it refers to a file. Otherwise Optional.absent().- Specified by:
toFilein interfaceConfigFileLoaderPlugin- Parameters:
fileUri- the uri to use to resolve to a file (or not).
-
lastModified
Description copied from interface:ConfigFileLoaderPluginreturn the last modified time of the file URI.- Specified by:
lastModifiedin interfaceConfigFileLoaderPlugin- Parameters:
fileURI- the uri of the config file to load.- Returns:
- return the last modified date of the file
-
isAccessible
Description copied from interface:ConfigFileLoaderPluginCheck if the configuration File exists.- Specified by:
isAccessiblein interfaceConfigFileLoaderPlugin- Parameters:
fileURI- the uri of the file to load.
-
loadFile
Description copied from interface:ConfigFileLoaderPluginLoad the config data.- Specified by:
loadFilein interfaceConfigFileLoaderPlugin- Parameters:
fileURI- the uri of the config file to load.- Returns:
- the file that make up the file.
- Throws:
IOException
-
isAccessible
Description copied from interface:ConfigFileLoaderPlugincheck if the file exists and can be accessed by the user/template/config/etc...- Specified by:
isAccessiblein interfaceConfigFileLoaderPlugin- Parameters:
configFileUri- the uri of the configuration filepathToSubResource- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).
-
loadFile
Description copied from interface:ConfigFileLoaderPluginLoad the file related to the configuration file.- Specified by:
loadFilein interfaceConfigFileLoaderPlugin- Parameters:
configFileUri- the uri of the configuration filepathToSubResource- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).- Throws:
IOException
-
toFile
Description copied from interface:ConfigFileLoaderPluginReturn the file object the uri refers to if it refers to a file. Otherwise Optional.absent().- Specified by:
toFilein interfaceConfigFileLoaderPlugin- Parameters:
configFileUri- the uri of the configuration filepathToSubResource- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).
-