Class JarUtils

java.lang.Object
org.drools.util.JarUtils

public class JarUtils extends Object
Utility to access jar files
  • Method Details

    • normalizeSpringBootResourceUrlPath

      public static String normalizeSpringBootResourceUrlPath(String resourceUrlPath)
      Fix resource urls are acquired by spring boot classloader's getResources() for Spring Boot fat jar in order to be consistent with the actual path in the jar file. For example, Spring Boot 3.2 classloader's getResources() returns like "jar:nested:/path/to/demo.jar/!BOOT-INF/classes/!/org/example/MyClass.class" while the actual path in the jar file is "jar:nested:/path/to/demo.jar!/BOOT-INF/classes/org/example/MyClass.class" This method normalizes only the path part. The scheme part (e.g. "jar:nested:") can be handled by getPathWithoutScheme
      Parameters:
      resourceUrlPath - resource url path
      Returns:
      normalized resource url path
    • replaceNestedPathForSpringBoot32

      public static String replaceNestedPathForSpringBoot32(String urlPath)
      Replace the new spring-boot nested path representation "/!BOOT-INF/" (introduced since 3.2) with the old "!/BOOT-INF/". Because the new path representation doesn't meet the path manipulation in the drools codebase. See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
    • getPathWithoutScheme

      public static String getPathWithoutScheme(URL url)
      get path removing scheme prefix including additional scheme e.g. "jar:nested:"