@Override public String getServletPath() { ServletPathMatch match = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getServletPathMatch(); if (match != null) { return match.getMatched(); } return ""; }
private ServletPathMatch findWelcomeServlet(final String path, boolean requiresRedirect) { StringBuilder sb = new StringBuilder(); for (String i : welcomePages) { sb.append(path); sb.append(i); final String mergedPath = sb.toString(); sb.setLength(0); final ServletPathMatch handler = data.getServletHandlerByPath(mergedPath); if (handler != null && !handler.isRequiredWelcomeFileMatch()) { return new ServletPathMatch(handler.getServletChain(), handler.getMatched(), handler.getRemaining(), requiresRedirect ? REDIRECT : REWRITE, mergedPath); } } return null; }
switch (match.getMappingMatch()) { case EXACT: matchValue = match.getMatched(); if(matchValue.startsWith("/")) { matchValue = matchValue.substring(1); matchValue = match.getMatched().substring(0, match.getMatched().length() - match.getMatchString().length() + 1); if(matchValue.startsWith("/")) { matchValue = matchValue.substring(1);
String remaining = match.getRemaining() == null ? match.getMatched() : match.getRemaining(); Resource resource = resourceManager.getResource(remaining); if (resource == null || !resource.isDirectory()) { return match; } else { ServletPathMatch redirect = new ServletPathMatch(match.getServletChain(), match.getMatched(), match.getRemaining(), REDIRECT, "/"); pathMatchCache.add(path, redirect); return redirect;
requestImpl.setAttribute(INCLUDE_SERVLET_PATH, pathMatch.getMatched()); requestImpl.setAttribute(INCLUDE_PATH_INFO, pathMatch.getRemaining());