public void include()

in src/main/java/org/apache/sling/engine/impl/request/SlingRequestDispatcher.java [77:105]


    public void include(ServletRequest request, ServletResponse sResponse) throws ServletException, IOException {

        // guard access to the request and content data: If the request is
        // not (wrapping) a SlingHttpServletRequest, accessing the request Data
        // throws an IllegalArgumentException and we cannot continue
        final ContentData cd;
        try {
            cd = RequestData.getRequestData(request).getContentData();
        } catch (IllegalArgumentException iae) {
            throw new ServletException(iae.getMessage());
        }

        // ClassCastException is not expected here because we operate in
        // HTTP requests only (it cannot be excluded though if some client
        // code uses a ServletRequestWrapper rather than an
        // HttpServletRequestWrapper ...)
        final HttpServletRequest hRequest = (HttpServletRequest) request;
        final DispatchingInfo info = new DispatchingInfo(DispatcherType.INCLUDE);
        info.setRequestContent(cd.getResource());
        info.setRequestServlet(cd.getServlet());
        info.setRequestPathInfo(cd.getRequestPathInfo());
        info.setContextPath(hRequest.getContextPath());
        info.setPathInfo(hRequest.getPathInfo());
        info.setQueryString(hRequest.getQueryString());
        info.setRequestUri(hRequest.getRequestURI());
        info.setServletPath(hRequest.getServletPath());

        dispatch(request, sResponse, info);
    }