code: protected static String[] makeComponents(String resourceId) {
          if (resourceId == null || resourceId.isEmpty()
                  || !resourceId.startsWith("/")) {
              return null;
          }
  
          List<String> components = new ArrayList<String>();
  
          String[] parts = resourceId.split("\\/");
  
          int bufPrimer = 0;
          for (int x = 1; x < parts.length; x++) {
              bufPrimer = Math.max(bufPrimer, (parts[x].length() + 1));
              StringBuilder sb = new StringBuilder(bufPrimer);
              for (int y = 0; y < x; y++) {
                  sb.append("/");
                  sb.append(parts[y + 1]);
              }
  
              String componentBase = sb.toString();
              bufPrimer = componentBase.length() + 16;
              components.add(componentBase);
  
              if (x != parts.length - 1) {
                  components.add(componentBase.concat("/.*"));
              } else {
                  components.add(componentBase.concat("$"));
              }
          }
  
          return components.toArray(parts);
      }
docs: Splits a XACML hierarchical resource-id value into a set of resource-id values
  that can be matched against a policy.
  
  Eg an incoming request for /res1/res2/res3/.* should match
  /res1/.*
  /res1/res2/.*
  /res1/res2/res3/.*
  
  in policies.
  
  @param resourceId XACML hierarchical resource-id value
  @return array of individual resource-id values that can be used to match against policies