code: public static String getRelativeInsideWebInf(Resource resource) {
          if (resource == null) return null;
  
          try {
              String url = resource.getURL().toString();
              int i = url.indexOf(WEB_INF);
              if (i > -1) {
                  return url.substring(i);
              }
  
              Matcher m = PLUGIN_PATTERN.matcher(url);
              if (m.find()) {
                  return WEB_INF + m.group(1);
              }
  
              i = url.lastIndexOf(GRAILS_APP_DIR);
              if (i > -1) {
                  return WEB_INF + "/" + url.substring(i);
              }
          }
          catch (IOException e) {
              return null;
          }
          return null;
      }
docs: Takes a Grails resource (one located inside the grails-app dir) and gets its relative path inside the WEB-INF directory
  when deployed.
  
  @param resource The Grails resource, which is a file inside the grails-app dir
  @return The relative URL of the file inside the WEB-INF dir at deployment time or null if it cannot be established