ContainerUtils { public static String reduceLeadingSlashes(final String path) { int length; if (path == null || (length = path.length()) == 0) { return path; } int start = 0; while (start != length && "/".indexOf(path.charAt(start)) != -1) { start++; } return path.substring(start > 0 ? start - 1 : 0); }  static String encodeUnsafeCharacters(final String originalQueryString); static String reduceLeadingSlashes(final String path); static String getHandlerPath(String uri);  }
@Test public void testReduceLeadingSlashes() { assertNull(reduceLeadingSlashes(null)); assertEquals("path/to/endpoint", reduceLeadingSlashes("path/to/endpoint")); assertEquals("/path/to/endpoint", reduceLeadingSlashes("/path/to/endpoint")); assertEquals("/path/to/endpoint", reduceLeadingSlashes(" assertEquals("/path }