protected RequestDispatcher doGetRequestDispatcher(ServletContext servletContext, String path) { if (!PropsValues.DIRECT_SERVLET_CONTEXT_ENABLED) { return servletContext.getRequestDispatcher(path); } if ((path == null) || (path.length() == 0)) { return null; } if (path.charAt(0) != CharPool.SLASH) { throw new IllegalArgumentException("Path " + path + " is not relative to context root"); } String contextPath = ContextPathUtil.getContextPath(servletContext); String fullPath = contextPath.concat(path); String queryString = null; int pos = fullPath.indexOf(CharPool.QUESTION); if (pos != -1) { queryString = fullPath.substring(pos + 1); fullPath = fullPath.substring(0, pos); } Servlet servlet = DirectServletRegistryUtil.getServlet(fullPath); if (servlet == null) { if (_log.isDebugEnabled()) { _log.debug("No servlet found for " + fullPath); } RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(path); return new DirectServletPathRegisterDispatcher(path, requestDispatcher); } else { if (_log.isDebugEnabled()) { _log.debug("Servlet found for " + fullPath); } return new DirectRequestDispatcher(servlet, queryString); } }