Jan 15th, 2010, 12:09 AM
ResourceLoader to load files from a jar on file system
I'm currently working on an application which scans a directory that contains deployed java applications (jars) and reads a number of xml configuration files found in each of the jars (under /META-INF/DAO/*.xml)
I found another thread (http://forum.springsource.org/showthread.php?t=49249) on this forum, but it fails to answer the question of how one could use a ResourceLoader to access such content.
I've tried using PathMatchingResourcePatternResolver to load "jar:/path_to_jar/jar_file_name.jar!/WEB-INF/DAO/*.xml" but this failed on every attempt.
PathMatchingResourcePatternResolver has the method doFindPathMatchingJarResources which seems to be what I need (it splits on !/ and treats the first part as a path to a jar file, where as the latter part is a path within the jar). Nevertheless, this method is called from one place in the class and in order to be called, the condition isJarResource("jar:/path_to_jar/jar_file_name.jar!/WEB-INF/DAO/") keeps failing.
Any help would be greately appreciated!
Jan 15th, 2010, 12:55 AM
I guess this is one of the fastest turn arounds..
I needed to use the following path instead:
On a different note, i wouldn't have been able to do this without Google code Search!!!
Query for ".jar!/WEB lang:java" returned loads of answers that correctly use the file: in the URL description
Tags for this Thread