Search in sources :

Example 1 with ContentData

use of org.apache.sling.engine.impl.request.ContentData in project sling by apache.

the class SlingRequestProcessorImpl method dispatchRequest.

// ---------- Generic Content Request processor ----------------------------
/**
     * Dispatches the request on behalf of the
     * {@link org.apache.sling.engine.impl.request.SlingRequestDispatcher}.
     */
public void dispatchRequest(ServletRequest request, ServletResponse response, Resource resource, RequestPathInfo resolvedURL, boolean include) throws IOException, ServletException {
    // we need a SlingHttpServletRequest/SlingHttpServletResponse tupel
    // to continue
    SlingHttpServletRequest cRequest = RequestData.toSlingHttpServletRequest(request);
    SlingHttpServletResponse cResponse = RequestData.toSlingHttpServletResponse(response);
    // get the request data (and btw check the correct type)
    final RequestData requestData = RequestData.getRequestData(cRequest);
    final ContentData oldContentData = requestData.getContentData();
    final ContentData contentData = requestData.setContent(resource, resolvedURL);
    try {
        // resolve the servlet
        Servlet servlet = servletResolver.resolveServlet(cRequest);
        contentData.setServlet(servlet);
        FilterChainType type = include ? FilterChainType.INCLUDE : FilterChainType.FORWARD;
        processComponent(cRequest, cResponse, type);
    } finally {
        requestData.resetContent(oldContentData);
    }
}
Also used : SlingHttpServletResponse(org.apache.sling.api.SlingHttpServletResponse) ContentData(org.apache.sling.engine.impl.request.ContentData) RequestData(org.apache.sling.engine.impl.request.RequestData) Servlet(javax.servlet.Servlet) SlingHttpServletRequest(org.apache.sling.api.SlingHttpServletRequest) FilterChainType(org.apache.sling.engine.impl.filter.ServletFilterManager.FilterChainType)

Aggregations

Servlet (javax.servlet.Servlet)1 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)1 SlingHttpServletResponse (org.apache.sling.api.SlingHttpServletResponse)1 FilterChainType (org.apache.sling.engine.impl.filter.ServletFilterManager.FilterChainType)1 ContentData (org.apache.sling.engine.impl.request.ContentData)1 RequestData (org.apache.sling.engine.impl.request.RequestData)1