Fixing NoSuchElement exception thrown when standard context is accessed

revert-70aa11f8
prabathabey 9 years ago
parent 6ef4bdd73e
commit 46c5f2534f

@ -64,14 +64,18 @@ public class WebappAuthenticationHandler extends CarbonTomcatValve {
if (ctx == null || "".equals(ctx)) { if (ctx == null || "".equals(ctx)) {
ctx = request.getContextPath(); ctx = request.getContextPath();
if (ctx == null || "".equals(ctx)) { if (ctx == null || "".equals(ctx)) {
String requestUri = request.getRequestURI();
if ("/".equals(requestUri)) {
return true;
}
StringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), "/"); StringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), "/");
ctx = tokenizer.nextToken(); if (!tokenizer.hasMoreTokens()) {
if (ctx == null || "".equals(ctx)) {
return false; return false;
} }
ctx = tokenizer.nextToken();
} }
} }
return ctx.equalsIgnoreCase("carbon") || ctx.equalsIgnoreCase("services"); return (ctx.equalsIgnoreCase("carbon") || ctx.equalsIgnoreCase("services"));
} }
private void processResponse(Request request, Response response, CompositeValve compositeValve, private void processResponse(Request request, Response response, CompositeValve compositeValve,

Loading…
Cancel
Save