@ProviderType
public interface ServletResolver
ServletResolver
defines the API for a service capable of
resolving javax.servlet.Servlet
instances to handle the
processing of a request or resource.
Applications of the Sling Framework generally do not need the servlet
resolver as resolution of the servlets to process requests and sub-requests
through a RequestDispatcher
is handled by the Sling Framework.
Modifier and Type | Method and Description |
---|---|
javax.servlet.Servlet |
resolveServlet(ResourceResolver resolver,
String scriptName)
Resolves a
javax.servlet.Servlet whose
service method may be used to handle a request. |
javax.servlet.Servlet |
resolveServlet(Resource resource,
String scriptName)
Resolves a
javax.servlet.Servlet whose
service method may be used to handle a request. |
javax.servlet.Servlet |
resolveServlet(SlingHttpServletRequest request)
Resolves a
javax.servlet.Servlet whose
service method may be used to handle the given
request . |
@CheckForNull javax.servlet.Servlet resolveServlet(@Nonnull SlingHttpServletRequest request)
javax.servlet.Servlet
whose
service
method may be used to handle the given
request
.
The returned servlet must be assumed to be initialized and ready to run.
That is, the init
nor the destroy
methods
must NOT be called on the returned servlet.
This method must not return a Servlet
instance
implementing the OptingServlet
interface and returning
false
when the
OptingServlet.accepts(SlingHttpServletRequest)
method is called.
request
- The SlingHttpServletRequest
object used to drive
selection of the servlet.service
method may be called to
handle the request. Might be null
.SlingException
- Is thrown if an error occurs
while trying to find an appropriate servlet to handle the
request.NullPointerException
- If request
is null.@CheckForNull javax.servlet.Servlet resolveServlet(@Nonnull Resource resource, @Nonnull String scriptName)
javax.servlet.Servlet
whose
service
method may be used to handle a request.
The returned servlet must be assumed to be initialized and ready to run.
That is, the init
nor the destroy
methods
must NOT be called on the returned servlet.
This method skips all OptingServlet
s as there is no
request object available.
Basically this method searches a script with the scriptName
for the resource type defined by the resource
.
resource
- The Resource
object used to drive
selection of the servlet.scriptName
- The name of the script - the script might have an
extension. In this case only a script with the
matching extension is used.service
method may be called to
handle the request. Might be null
.SlingException
- Is thrown if an error occurs
while trying to find an appropriate servlet to handle the
request or if no servlet could be resolved to handle the
request.IllegalArgumentException
- If resource
is null.@CheckForNull javax.servlet.Servlet resolveServlet(@Nonnull ResourceResolver resolver, @Nonnull String scriptName)
javax.servlet.Servlet
whose
service
method may be used to handle a request.
The returned servlet must be assumed to be initialized and ready to run.
That is, the init
nor the destroy
methods
must NOT be called on the returned servlet.
This method skips all OptingServlet
s as there is no
request object available.
Basically this method searches a script with the scriptName
resolver
- The ResourceResolver
object used to drive
selection of the servlet.scriptName
- The name of the script - the script might have an
extension. In this case only a script with the
matching extension is used.service
method may be called to
handle the request. Might be null
.SlingException
- Is thrown if an error occurs
while trying to find an appropriate servlet to handle the
request.IllegalArgumentException
- If resolver
is null.Copyright © 2017 The Apache Software Foundation. All rights reserved.