Dispatching RequestsPage edited by Mike MuellerRequest ProcessingMain processThe following steps should give you an overview how a request is processed in Sling. Details can be found under provided links. Step 1The client sends the request Step 2This step applies only if a Servlet Container is installed and Sling is embedded: Step 3OSGi HttpService looks for responsible registered Servlet or resource (see 102.4 of the OSGi compendium) Step 4OSGi HttpService calls handleSecurity of the HttpContext associated with the servlet/resource. In case of Sling this calls into SlingMainServlet.handleSecurity and then into SlingAuthenticator.authenticate Step 4aSlingAuthenticator selects an authentication handler for the request and forwards the authenticate call. On success a javax.jcr.Session is created, the request attributes required by the HTTP Service spec are set (like org.osgi.service.http.authentication.remote.user and org.osgi.service.http.authentication.type}}and also the {{javax.jcr.Session which is used later is set in the request attributes. Step 4bIf authentication fails either an anonymous session is acquired (if anonymous is allowed per configuration) or the login method is called. Step 4cThe login method selects an AuthenticationHandler and forwards the login call to the AuthenticationHandler.requestAuthentication method to cause the client to authenticate. Request processing stops here (SlingMainServlet.handleSecurity returns false). Step 5After getting a response the HttpService either terminates the request (if authentication failed and SlingMainServlet.handleSecurity returned false) or continues by either spooling the resource or in the case of Sling calling the SlingMainServlet.service method. Step 6The SlingMainServlet.service method is the entry point into the Sling proper. This method sets up the request:
Step 7After this setup, the request level filters are called (the ones registered as javax.servlet.Filter with the property filter.scope=request, see Filters for details). Step 8After having called all request level filters, the component level filters (registered with the property filter.scope=component, see Filters for details) are called. Step 9After having called the component level filters, the request servlet or script is finally called to process the request. Include/ForwardIf a servlet or script is including another resource for processing through the RequestDispatcher.include or RequestDispatcher.forward (or any JSP or feature of another scripting language which relies on one of this two methods) the following processing takes place: Step 1Code in the processing servlet or script calls RequestDispatcher.include or RequestDispatcher.forward. Step 2The resource is resolved though ResourceResolver.getResource (if the RequestDispatcher has not been created with a resource already) Step 3The servlet or script to handle the resource is resolved calling the ServletResolver.resolverServlet method. Step 4The component level filters (registered with the property filter.scope=component) are called again (see Filters for details). Step 5The servlet or script is called to process the request. Note that these steps are processed for every include or forward call.
Change Notification Preferences
View Online
|
View Change
|
Add Comment
|
- [CONF] Apache Sling Website > Dispatching Requests confluence
