Announcement Announcement Module
No announcement yet.
ResourceLoader to load files from a jar on file system Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 ( 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:

    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