in hawtio-system/src/main/java/io/hawt/web/auth/RelativeRequestUri.java [59:95]
public RelativeRequestUri(final HttpServletRequest request,
final int pathIndex) {
if (pathIndex < 0) {
throw new IllegalArgumentException("pathIndex is negative");
}
final String requestUri = Strings.webContextPath(request.getRequestURI());
int start = request.getContextPath().length();
if (start < requestUri.length() && requestUri.charAt(start) == '/') {
start++;
}
if (pathIndex != 0) {
int c = 0;
do {
int i = requestUri.indexOf('/', start);
start = i + 1;
if (start == 0) {
start = requestUri.length();
break;
}
c++;
} while (c < pathIndex);
}
if (start < requestUri.length()) {
this.uriPrefix = requestUri.substring(0, start);
this.uri = requestUri.substring(start);
} else {
this.uriPrefix = requestUri;
this.uri = "";
}
this.uriComponents = uri.isEmpty() ? new String[0]
: PATH_SPLITTER.split(uri);
this.request = request;
}