| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
| +--org.springframework.web.servlet.HttpServletBean | +--org.springframework.web.servlet.FrameworkServlet
Base servlet for servlets within the web framework. Allows integration with an application context, in a JavaBean-based overall solution.
This class offers the following functionality:
Subclasses must implement doService() to handle requests. Because this extends HttpServletBean rather than HttpServlet directly, bean properties are mapped onto it. Subclasses can override initFrameworkServlet() for custom initialization.
Regards a "contextClass" parameter at the servlet init-param level, falling back to the default context class (XmlWebApplicationContext) if not found. With the default FrameworkServlet, a context class needs to implement ConfigurableWebApplicationContext.
Passes a "contextConfigLocation" servlet init-param to the context instance, parsing it into potentially multiple file paths which can be separated by any number of commas and spaces, like "test-servlet.xml, myServlet.xml". If not explicitly specified, the context implementation is supposed to build a default location from the namespace of the servlet.
Note: In case of multiple config locations, later bean definitions will override ones defined in earlier loaded files, at least when using one of Spring's default ApplicationContext implementations. This can be leveraged to deliberately override certain bean definitions via an extra XML file.
The default namespace is "'servlet-name'-servlet", e.g. "test-servlet" for a servlet-name "test" (leading to a "/WEB-INF/test-servlet.xml" default location with XmlWebApplicationContext). The namespace can also be set explicitly via the "namespace" servlet init-param.
Field Summary | |
final static Class | DEFAULT_CONTEXT_CLASS Default context class for FrameworkServlet. |
final static String | DEFAULT_NAMESPACE_SUFFIX Suffix for namespace bean factory names. |
final static String | SERVLET_CONTEXT_PREFIX Prefix for the ServletContext attribute for the web application context. |
Method Summary | |
void | destroy() |
Class | getContextClass() Return the custom context class. |
String | getContextConfigLocation() Return the explicit context config location, if any. |
String | getNamespace() Return the namespace for this servlet, falling back to default scheme if no custom namespace was set: e.g. |
final String | getServletContextAttributeName() Return the ServletContext attribute name for this servlet's WebApplicationContext. |
final WebApplicationContext | getWebApplicationContext() Return this servlet's WebApplicationContext. |
boolean | isPublishContext() Return whether to publish this servlet's context as a ServletContext attribute. |
final void | setContextClass(Class contextClass) Set a custom context class. |
void | setContextConfigLocation(String contextConfigLocation) Set the context config location explicitly, instead of relying on the default location built from the namespace. |
void | setNamespace(String namespace) Set a custom namespace for this servlet, to be used for building a default context config location. |
final void | setPublishContext(boolean publishContext) Set whether to publish this servlet's context as a ServletContext attribute. |
Methods inherited from class org.springframework.web.servlet.HttpServletBean |
init |
Field Detail |
public final static Class DEFAULT_CONTEXT_CLASS
public final static String DEFAULT_NAMESPACE_SUFFIX
public final static String SERVLET_CONTEXT_PREFIX
Method Detail |
public void destroy()
public Class getContextClass()
public String getContextConfigLocation()
public String getNamespace()
public final String getServletContextAttributeName()
public final WebApplicationContext getWebApplicationContext()
public boolean isPublishContext()
public final void setContextClass(Class contextClass)
public void setContextConfigLocation(String contextConfigLocation)
public void setNamespace(String namespace)
public final void setPublishContext(boolean publishContext)
Association Links |
to Class java.lang.Class
to Class java.lang.String
to Class java.lang.Class
to Class java.lang.String
to Class java.lang.String
to Class org.springframework.web.context.WebApplicationContext
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |