Announcement Announcement Module
Collapse
No announcement yet.
ResourceLoader to load files from a jar on file system Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    Got it

    I guess this is one of the fastest turn arounds..

    I needed to use the following path instead:
    jar:file:/path_to_jar/jar_file_name.jar!/WEB-INF/DAO/*.xml

    On a different note, i wouldn't have been able to do this without Google code Search!!!

    http://www.google.com/codesearch

    Query for ".jar!/WEB lang:java" returned loads of answers that correctly use the file: in the URL description

    Comment

    Working...
    X