Package org.mapfish.print
Class FileUtils
java.lang.Object
org.mapfish.print.FileUtils
Methods for interacting with files. Such things and verifying the files are in the correct
directory, Converting URLs to file objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertFileIsInConfigDir(Configuration configuration, File file) Verify that the file is within the configuration directory.static booleanassertIsSubDirectory(String descriptorOfBase, File child, File... baseFiles) Verify that the file is within the base directory.static URLtestForLegalFileUrl(Configuration configuration, URL url) Check if the url is a file url which is either relative to the configuration directory or refers to a file in the configuration directory.
-
Method Details
-
testForLegalFileUrl
Check if the url is a file url which is either relative to the configuration directory or refers to a file in the configuration directory.The correct file url is returned or the original if not a file url. If an illegal file url (one that does not refer to a file within the configuration directory or is relative to the configuration directory) then an exception is thrown.
- Parameters:
configuration- the configuration to test relativity.url- the url to test
-
assertFileIsInConfigDir
Verify that the file is within the configuration directory.- Parameters:
configuration- the configuration to test relativity.file- the file to test
-
assertIsSubDirectory
Verify that the file is within the base directory.IllegalFileAccessExceptionwill be thrown if the assertion does not hold.- Parameters:
descriptorOfBase- a simple description of the base file, for example: configurationchild- the file to test that is is a child of base.baseFiles- the directories that can legally contain the child.
-