@Test public void getContentPath_noMatch() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin"); assertThat(SlingshotUtil.getContentPath(resource), nullValue()); }
public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; }
SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; } }
SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; }  }
SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; }  static String getUserId(final Resource resource); static String getContentPath(final Resource resource); static boolean isUser(final SlingHttpServletRequest request); }
SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; }  static String getUserId(final Resource resource); static String getContentPath(final Resource resource); static boolean isUser(final SlingHttpServletRequest request);  }