public class MvcContext extends Object implements org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
Configures a bundle-specific ApplicationContext with the Spring MVC infrastructure beans usually
provided to web application contexts by the
DispatcherServlet. Subsequently
initializes
a context-specific DispatcherServlet instance with the so configured context. The resulting
dispatcher servlet is a fully-featured dispatcher servlet for the specific bundle, with the
exception of event publication, which is disabled
as it requires a WebApplicationContext.
<mvc:.../> XML configuration in their application context XML.
Like the DispatcherServlet, the MvcContext will only provide MVC infrastructure
beans if no suitable beans exist in the provided context.| Constructor and Description |
|---|
MvcContext(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
initializeDispatcherServlet(javax.servlet.ServletConfig config) |
boolean |
isResponsibleFor(javax.servlet.http.HttpServletRequest request) |
boolean |
mustInitializeDispatcherServlet() |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event)
Configures the context's bean factory with MVC infrastructure beans.
|
void |
service(SlingMvcServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
Delegates to the context specific
HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse). |
public MvcContext(org.springframework.beans.factory.config.ConfigurableListableBeanFactory factory)
factory - must not be null.public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>event - must not be null.public boolean isResponsibleFor(javax.servlet.http.HttpServletRequest request)
request - must not be null.true if this context has been
initialized
and the DispatcherServlet contains a
handler for the request.public void service(SlingMvcServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException
HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse).
Must only be called if isResponsibleFor(javax.servlet.http.HttpServletRequest) returns true.request - must not be null.response - request must not be null.javax.servlet.ServletExceptionIOExceptionpublic void initializeDispatcherServlet(javax.servlet.ServletConfig config)
public boolean mustInitializeDispatcherServlet()
Copyright © 2014–2015. All rights reserved.