Interface ServletResolver
-
@ProviderType public interface ServletResolver
TheServletResolver
defines the API for a service capable of resolvingjavax.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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable Servlet
resolveServlet(@NotNull Resource resource, @NotNull java.lang.String scriptName)
Resolves ajavax.servlet.Servlet
whoseservice
method may be used to handle a request.@Nullable Servlet
resolveServlet(@NotNull ResourceResolver resolver, @NotNull java.lang.String scriptName)
Resolves ajavax.servlet.Servlet
whoseservice
method may be used to handle a request.@Nullable Servlet
resolveServlet(@NotNull SlingHttpServletRequest request)
Resolves ajavax.servlet.Servlet
whoseservice
method may be used to handle the givenrequest
.
-
-
-
Method Detail
-
resolveServlet
@Nullable @Nullable Servlet resolveServlet(@NotNull @NotNull SlingHttpServletRequest request)
Resolves ajavax.servlet.Servlet
whoseservice
method may be used to handle the givenrequest
.The returned servlet must be assumed to be initialized and ready to run. That is, the
init
nor thedestroy
methods must NOT be called on the returned servlet.This method must not return a
Servlet
instance implementing theOptingServlet
interface and returningfalse
when theOptingServlet.accepts(SlingHttpServletRequest)
method is called.- Parameters:
request
- TheSlingHttpServletRequest
object used to drive selection of the servlet.- Returns:
- The servlet whose
service
method may be called to handle the request. Might benull
. - Throws:
SlingException
- Is thrown if an error occurs while trying to find an appropriate servlet to handle the request.java.lang.NullPointerException
- Ifrequest
is null.
-
resolveServlet
@Nullable @Nullable Servlet resolveServlet(@NotNull @NotNull Resource resource, @NotNull @NotNull java.lang.String scriptName)
Resolves ajavax.servlet.Servlet
whoseservice
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 thedestroy
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 thescriptName
for the resource type defined by theresource
.- Parameters:
resource
- TheResource
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.- Returns:
- The servlet whose
service
method may be called to handle the request. Might benull
. - Throws:
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.java.lang.IllegalArgumentException
- Ifresource
is null.- Since:
- 2.1 (Sling API Bundle 2.1.0)
-
resolveServlet
@Nullable @Nullable Servlet resolveServlet(@NotNull @NotNull ResourceResolver resolver, @NotNull @NotNull java.lang.String scriptName)
Resolves ajavax.servlet.Servlet
whoseservice
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 thedestroy
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 thescriptName
- Parameters:
resolver
- TheResourceResolver
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.- Returns:
- The servlet whose
service
method may be called to handle the request. Might benull
. - Throws:
SlingException
- Is thrown if an error occurs while trying to find an appropriate servlet to handle the request.java.lang.IllegalArgumentException
- Ifresolver
is null.- Since:
- 2.1 (Sling API Bundle 2.1.0)
-
-