Class FrameworkServlet
- All Implemented Interfaces:
- Servlet,- ServletConfig,- Serializable,- Aware,- ApplicationContextAware,- EnvironmentAware,- EnvironmentCapable
- Direct Known Subclasses:
- DispatcherServlet
This class offers the following functionality:
- Manages a WebApplicationContextinstance per servlet. The servlet's configuration is determined by beans in the servlet's namespace.
- Publishes events on request processing, whether or not a request is successfully handled.
Subclasses must implement doService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse) to handle requests. Because this extends
 HttpServletBean rather than HttpServlet directly, bean properties are
 automatically mapped onto it. Subclasses can override initFrameworkServlet()
 for custom initialization.
 
Detects a "contextClass" parameter at the servlet init-param level,
 falling back to the default context class,
 XmlWebApplicationContext, if not found. Note that, with the default
 FrameworkServlet, a custom context class needs to implement the
 ConfigurableWebApplicationContext SPI.
 
Accepts an optional "contextInitializerClasses" servlet init-param that
 specifies one or more ApplicationContextInitializer classes. The managed web application context will be
 delegated to these initializers, allowing for additional programmatic configuration,
 e.g. adding property sources or activating profiles against the context's
 environment. See also ContextLoader which
 supports a "contextInitializerClasses" context-param with identical semantics for
 the "root" web application context.
 
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 Spring's default ApplicationContext implementation. 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.
As of Spring 3.1, FrameworkServlet may now be injected with a web
 application context, rather than creating its own internally. This is useful in Servlet
 3.0+ environments, which support programmatic registration of servlet instances. See
 FrameworkServlet(WebApplicationContext) Javadoc for details.
- Author:
- Rod Johnson, Juergen Hoeller, Sam Brannen, Chris Beams, Rossen Stoyanchev, Phillip Webb
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Class<?>Default context class for FrameworkServlet.static final StringSuffix for WebApplicationContext namespaces.static final StringPrefix for the ServletContext attribute for the WebApplicationContext.Fields inherited from class org.springframework.web.servlet.HttpServletBeanloggerFields inherited from class jakarta.servlet.http.HttpServletLEGACY_DO_HEAD
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newFrameworkServletthat will create its own internal web application context based on defaults and values provided through servlet init-params.FrameworkServlet(WebApplicationContext webApplicationContext) Create a newFrameworkServletwith the given web application context.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidDelegate the WebApplicationContext before it is refreshed to anyApplicationContextInitializerinstances specified by the "contextInitializerClasses" servlet init-param.protected LocaleContextbuildLocaleContext(HttpServletRequest request) Build a LocaleContext for the given request, exposing the request's primary locale as current locale.protected ServletRequestAttributesbuildRequestAttributes(HttpServletRequest request, HttpServletResponse response, RequestAttributes previousAttributes) Build ServletRequestAttributes for the given request (potentially also holding a reference to the response), taking pre-bound attributes (and their type) into consideration.protected voidprotected WebApplicationContextInstantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContextor acustom context class, if set.protected WebApplicationContextInstantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContextor acustom context class, if set.voiddestroy()Close the WebApplicationContext of this servlet.protected final voiddoDelete(HttpServletRequest request, HttpServletResponse response) Delegate DELETE requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).protected final voiddoGet(HttpServletRequest request, HttpServletResponse response) Delegate GET requests to processRequest/doService.protected voiddoOptions(HttpServletRequest request, HttpServletResponse response) Delegate OPTIONS requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse), if desired.protected final voiddoPost(HttpServletRequest request, HttpServletResponse response) Delegate POST requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).protected final voiddoPut(HttpServletRequest request, HttpServletResponse response) Delegate PUT requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).protected abstract voiddoService(HttpServletRequest request, HttpServletResponse response) Subclasses must implement this method to do the work of request handling, receiving a centralized callback for GET, POST, PUT and DELETE.protected voiddoTrace(HttpServletRequest request, HttpServletResponse response) Delegate TRACE requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse), if desired.protected WebApplicationContextReturn the name of the ServletContext attribute which should be used to retrieve theWebApplicationContextthat this servlet is supposed to use.Class<?>Return the custom context class.Return the explicit context config location, if any.Return the custom WebApplicationContext id, if any.Return the namespace for this servlet, falling back to default scheme if no custom namespace was set: e.g.Return the ServletContext attribute name for this servlet's WebApplicationContext.protected StringgetUsernameForRequest(HttpServletRequest request) Determine the username for the given request.final WebApplicationContextReturn this servlet's WebApplicationContext.protected voidThis method will be invoked after any bean properties have been set and the WebApplicationContext has been loaded.protected final voidOverridden method ofHttpServletBean, invoked after any bean properties have been set.protected WebApplicationContextInitialize and publish the WebApplicationContext for this servlet.booleanWhether logging of potentially sensitive, request details at DEBUG and TRACE level is allowed.voidCallback that receives refresh events from this servlet's WebApplicationContext.protected voidonRefresh(ApplicationContext context) Template method which can be overridden to add servlet-specific refresh work.protected voidPost-process the given WebApplicationContext before it is refreshed and activated as context for this servlet.protected final voidprocessRequest(HttpServletRequest request, HttpServletResponse response) Process this request, publishing an event regardless of the outcome.voidrefresh()Refresh this servlet's application context, as well as the dependent state of the servlet.protected voidservice(HttpServletRequest request, HttpServletResponse response) Override the parent class implementation in order to intercept PATCH requests.voidsetApplicationContext(ApplicationContext applicationContext) Called by Spring viaApplicationContextAwareto inject the current application context.voidsetContextAttribute(String contextAttribute) Set the name of the ServletContext attribute which should be used to retrieve theWebApplicationContextthat this servlet is supposed to use.voidsetContextClass(Class<?> contextClass) Set a custom context class.voidsetContextConfigLocation(String contextConfigLocation) Set the context config location explicitly, instead of relying on the default location built from the namespace.voidsetContextId(String contextId) Specify a custom WebApplicationContext id, to be used as serialization id for the underlying BeanFactory.voidsetContextInitializerClasses(String contextInitializerClasses) Specify the set of fully-qualifiedApplicationContextInitializerclass names, per the optional "contextInitializerClasses" servlet init-param.voidsetContextInitializers(ApplicationContextInitializer<?>... initializers) Specify whichApplicationContextInitializerinstances should be used to initialize the application context used by thisFrameworkServlet.voidsetDispatchOptionsRequest(boolean dispatchOptionsRequest) Set whether this servlet should dispatch an HTTP OPTIONS request to thedoService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)method.voidsetDispatchTraceRequest(boolean dispatchTraceRequest) Set whether this servlet should dispatch an HTTP TRACE request to thedoService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)method.voidsetEnableLoggingRequestDetails(boolean enable) Whether to log request params at DEBUG level, and headers at TRACE level.voidsetNamespace(String namespace) Set a custom namespace for this servlet, to be used for building a default context config location.voidsetPublishContext(boolean publishContext) Set whether to publish this servlet's context as a ServletContext attribute, available to all objects in the web container.voidsetPublishEvents(boolean publishEvents) Set whether this servlet should publish a ServletRequestHandledEvent at the end of each request.voidsetThreadContextInheritable(boolean threadContextInheritable) Set whether to expose the LocaleContext and RequestAttributes as inheritable for child threads (using anInheritableThreadLocal).Methods inherited from class org.springframework.web.servlet.HttpServletBeanaddRequiredProperty, createEnvironment, getEnvironment, getServletName, init, initBeanWrapper, setEnvironmentMethods inherited from class jakarta.servlet.http.HttpServletdoHead, getLastModified, init, serviceMethods inherited from class jakarta.servlet.GenericServletgetInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, log, log
- 
Field Details- 
DEFAULT_NAMESPACE_SUFFIXSuffix for WebApplicationContext namespaces. If a servlet of this class is given the name "test" in a context, the namespace used by the servlet will resolve to "test-servlet".- See Also:
 
- 
DEFAULT_CONTEXT_CLASSDefault context class for FrameworkServlet.- See Also:
 
- 
SERVLET_CONTEXT_PREFIXPrefix for the ServletContext attribute for the WebApplicationContext. The completion is the servlet name.
 
- 
- 
Constructor Details- 
FrameworkServletpublic FrameworkServlet()Create a newFrameworkServletthat will create its own internal web application context based on defaults and values provided through servlet init-params. Typically used in Servlet 2.5 or earlier environments, where the only option for servlet registration is throughweb.xmlwhich requires the use of a no-arg constructor.Calling setContextConfigLocation(java.lang.String)(init-param 'contextConfigLocation') will dictate which XML files will be loaded by the default XmlWebApplicationContextCalling setContextClass(java.lang.Class<?>)(init-param 'contextClass') overrides the defaultXmlWebApplicationContextand allows for specifying an alternative class, such asAnnotationConfigWebApplicationContext.Calling setContextInitializerClasses(java.lang.String)(init-param 'contextInitializerClasses') indicates whichApplicationContextInitializerclasses should be used to further configure the internal application context prior to refresh().- See Also:
 
- 
FrameworkServletCreate a newFrameworkServletwith the given web application context. This constructor is useful in Servlet environments where instance-based registration of servlets is possible through theServletContext.addServlet(java.lang.String, java.lang.String)API.Using this constructor indicates that the following properties / init-params will be ignored: - setContextClass(Class)/ 'contextClass'
- setContextConfigLocation(String)/ 'contextConfigLocation'
- setContextAttribute(String)/ 'contextAttribute'
- setNamespace(String)/ 'namespace'
 The given web application context may or may not yet be refreshed. If it (a) is an implementation of ConfigurableWebApplicationContextand (b) has not already been refreshed (the recommended approach), then the following will occur:- If the given context does not already have a parent, the root application context will be set as the parent.
- If the given context has not already been assigned an id, one will be assigned to it
- ServletContextand- ServletConfigobjects will be delegated to the application context
- postProcessWebApplicationContext(org.springframework.web.context.ConfigurableWebApplicationContext)will be called
- Any ApplicationContextInitializersspecified through the "contextInitializerClasses" init-param or through thesetContextInitializers(org.springframework.context.ApplicationContextInitializer<?>...)property will be applied.
- refresh()will be called
 ConfigurableWebApplicationContext, none of the above will occur under the assumption that the user has performed these actions (or not) per his or her specific needs.See WebApplicationInitializerfor usage examples.- Parameters:
- webApplicationContext- the context to use
- See Also:
 
 
- 
- 
Method Details- 
setContextAttributeSet the name of the ServletContext attribute which should be used to retrieve theWebApplicationContextthat this servlet is supposed to use.
- 
getContextAttributeReturn the name of the ServletContext attribute which should be used to retrieve theWebApplicationContextthat this servlet is supposed to use.
- 
setContextClassSet a custom context class. This class must be of typeWebApplicationContext.When using the default FrameworkServlet implementation, the context class must also implement the ConfigurableWebApplicationContextinterface.
- 
getContextClassReturn the custom context class.
- 
setContextIdSpecify a custom WebApplicationContext id, to be used as serialization id for the underlying BeanFactory.
- 
getContextIdReturn the custom WebApplicationContext id, if any.
- 
setNamespaceSet a custom namespace for this servlet, to be used for building a default context config location.
- 
getNamespaceReturn the namespace for this servlet, falling back to default scheme if no custom namespace was set: e.g. "test-servlet" for a servlet named "test".
- 
setContextConfigLocationSet the context config location explicitly, instead of relying on the default location built from the namespace. This location string can consist of multiple locations separated by any number of commas and spaces.
- 
getContextConfigLocationReturn the explicit context config location, if any.
- 
setContextInitializersSpecify whichApplicationContextInitializerinstances should be used to initialize the application context used by thisFrameworkServlet.
- 
setContextInitializerClassesSpecify the set of fully-qualifiedApplicationContextInitializerclass names, per the optional "contextInitializerClasses" servlet init-param.
- 
setPublishContextpublic void setPublishContext(boolean publishContext) Set whether to publish this servlet's context as a ServletContext attribute, available to all objects in the web container. Default is "true".This is especially handy during testing, although it is debatable whether it's good practice to let other application objects access the context this way. 
- 
setPublishEventspublic void setPublishEvents(boolean publishEvents) Set whether this servlet should publish a ServletRequestHandledEvent at the end of each request. Default is "true"; can be turned off for a slight performance improvement, provided that no ApplicationListeners rely on such events.- See Also:
 
- 
setThreadContextInheritablepublic void setThreadContextInheritable(boolean threadContextInheritable) Set whether to expose the LocaleContext and RequestAttributes as inheritable for child threads (using anInheritableThreadLocal).Default is "false", to avoid side effects on spawned background threads. Switch this to "true" to enable inheritance for custom child threads which are spawned during request processing and only used for this request (that is, ending after their initial task, without reuse of the thread). WARNING: Do not use inheritance for child threads if you are accessing a thread pool which is configured to potentially add new threads on demand (e.g. a JDK ThreadPoolExecutor), since this will expose the inherited context to such a pooled thread.
- 
setDispatchOptionsRequestpublic void setDispatchOptionsRequest(boolean dispatchOptionsRequest) Set whether this servlet should dispatch an HTTP OPTIONS request to thedoService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)method.Default in the FrameworkServletis "false", applyingHttpServlet's default behavior (i.e.enumerating all standard HTTP request methods as a response to the OPTIONS request). Note however that as of 4.3 theDispatcherServletsets this property to "true" by default due to its built-in support for OPTIONS.Turn this flag on if you prefer OPTIONS requests to go through the regular dispatching chain, just like other HTTP requests. This usually means that your controllers will receive those requests; make sure that those endpoints are actually able to handle an OPTIONS request. Note that HttpServlet's default OPTIONS processing will be applied in any case if your controllers happen to not set the 'Allow' header (as required for an OPTIONS response). 
- 
setDispatchTraceRequestpublic void setDispatchTraceRequest(boolean dispatchTraceRequest) Set whether this servlet should dispatch an HTTP TRACE request to thedoService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)method.Default is "false", applying HttpServlet's default behavior (i.e. reflecting the message received back to the client).Turn this flag on if you prefer TRACE requests to go through the regular dispatching chain, just like other HTTP requests. This usually means that your controllers will receive those requests; make sure that those endpoints are actually able to handle a TRACE request. Note that HttpServlet's default TRACE processing will be applied in any case if your controllers happen to not generate a response of content type 'message/http' (as required for a TRACE response). 
- 
setEnableLoggingRequestDetailspublic void setEnableLoggingRequestDetails(boolean enable) Whether to log request params at DEBUG level, and headers at TRACE level. Both may contain sensitive information.By default set to falseso that request details are not shown.- Parameters:
- enable- whether to enable or not
- Since:
- 5.1
 
- 
isEnableLoggingRequestDetailspublic boolean isEnableLoggingRequestDetails()Whether logging of potentially sensitive, request details at DEBUG and TRACE level is allowed.- Since:
- 5.1
 
- 
setApplicationContextCalled by Spring viaApplicationContextAwareto inject the current application context. This method allows FrameworkServlets to be registered as Spring beans inside an existingWebApplicationContextrather thanfindingabootstrappedcontext.Primarily added to support use in embedded servlet containers. - Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Parameters:
- applicationContext- the ApplicationContext object to be used by this object
- Since:
- 4.0
- See Also:
 
- 
initServletBeanOverridden method ofHttpServletBean, invoked after any bean properties have been set. Creates this servlet's WebApplicationContext.- Overrides:
- initServletBeanin class- HttpServletBean
- Throws:
- ServletException- if subclass initialization fails
 
- 
initWebApplicationContextInitialize and publish the WebApplicationContext for this servlet.Delegates to createWebApplicationContext(org.springframework.context.ApplicationContext)for actual creation of the context. Can be overridden in subclasses.- Returns:
- the WebApplicationContext instance
- See Also:
 
- 
findWebApplicationContextRetrieve aWebApplicationContextfrom theServletContextattribute with theconfigured name. TheWebApplicationContextmust have already been loaded and stored in theServletContextbefore this servlet gets initialized (or invoked).Subclasses may override this method to provide a different WebApplicationContextretrieval strategy.- Returns:
- the WebApplicationContext for this servlet, or nullif not found
- See Also:
 
- 
createWebApplicationContextInstantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContextor acustom context class, if set.This implementation expects custom contexts to implement the ConfigurableWebApplicationContextinterface. Can be overridden in subclasses.Do not forget to register this servlet instance as application listener on the created context (for triggering its callback), and to callConfigurableApplicationContext.refresh()before returning the context instance.- Parameters:
- parent- the parent ApplicationContext to use, or- nullif none
- Returns:
- the WebApplicationContext for this servlet
- See Also:
 
- 
configureAndRefreshWebApplicationContext
- 
createWebApplicationContextInstantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContextor acustom context class, if set. Delegates to #createWebApplicationContext(ApplicationContext).- Parameters:
- parent- the parent WebApplicationContext to use, or- nullif none
- Returns:
- the WebApplicationContext for this servlet
- See Also:
 
- 
postProcessWebApplicationContextPost-process the given WebApplicationContext before it is refreshed and activated as context for this servlet.The default implementation is empty. refresh()will be called automatically after this method returns.Note that this method is designed to allow subclasses to modify the application context, while initWebApplicationContext()is designed to allow end-users to modify the context through the use ofApplicationContextInitializers.- Parameters:
- wac- the configured WebApplicationContext (not refreshed yet)
- See Also:
 
- 
applyInitializersDelegate the WebApplicationContext before it is refreshed to anyApplicationContextInitializerinstances specified by the "contextInitializerClasses" servlet init-param.See also postProcessWebApplicationContext(org.springframework.web.context.ConfigurableWebApplicationContext), which is designed to allow subclasses (as opposed to end-users) to modify the application context, and is called immediately before this method.- Parameters:
- wac- the configured WebApplicationContext (not refreshed yet)
- See Also:
 
- 
getServletContextAttributeNameReturn the ServletContext attribute name for this servlet's WebApplicationContext.The default implementation returns SERVLET_CONTEXT_PREFIX + servlet name.
- 
getWebApplicationContextReturn this servlet's WebApplicationContext.
- 
initFrameworkServletThis method will be invoked after any bean properties have been set and the WebApplicationContext has been loaded. The default implementation is empty; subclasses may override this method to perform any initialization they require.- Throws:
- ServletException- in case of an initialization exception
 
- 
refreshpublic void refresh()Refresh this servlet's application context, as well as the dependent state of the servlet.
- 
onApplicationEventCallback that receives refresh events from this servlet's WebApplicationContext.The default implementation calls onRefresh(org.springframework.context.ApplicationContext), triggering a refresh of this servlet's context-dependent state.- Parameters:
- event- the incoming ApplicationContext event
 
- 
onRefreshTemplate method which can be overridden to add servlet-specific refresh work. Called after successful context refresh.This implementation is empty. - Parameters:
- context- the current WebApplicationContext
- See Also:
 
- 
destroypublic void destroy()Close the WebApplicationContext of this servlet.- Specified by:
- destroyin interface- Servlet
- Overrides:
- destroyin class- GenericServlet
- See Also:
 
- 
serviceprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Override the parent class implementation in order to intercept PATCH requests.- Overrides:
- servicein class- HttpServlet
- Throws:
- ServletException
- IOException
 
- 
doGetprotected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate GET requests to processRequest/doService.Will also be invoked by HttpServlet's default implementation of doHead, with aNoBodyResponsethat just captures the content length.
- 
doPostprotected final void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate POST requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).- Overrides:
- doPostin class- HttpServlet
- Throws:
- ServletException
- IOException
- See Also:
 
- 
doPutprotected final void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate PUT requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).- Overrides:
- doPutin class- HttpServlet
- Throws:
- ServletException
- IOException
- See Also:
 
- 
doDeleteprotected final void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate DELETE requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse).- Overrides:
- doDeletein class- HttpServlet
- Throws:
- ServletException
- IOException
- See Also:
 
- 
doOptionsprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate OPTIONS requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse), if desired.Applies HttpServlet's standard OPTIONS processing otherwise, and also if there is still no 'Allow' header set after dispatching. - Overrides:
- doOptionsin class- HttpServlet
- Throws:
- ServletException
- IOException
- See Also:
 
- 
doTraceprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Delegate TRACE requests toprocessRequest(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse), if desired.Applies HttpServlet's standard TRACE processing otherwise. - Overrides:
- doTracein class- HttpServlet
- Throws:
- ServletException
- IOException
- See Also:
 
- 
processRequestprotected final void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Process this request, publishing an event regardless of the outcome.The actual event handling is performed by the abstract doService(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)template method.- Throws:
- ServletException
- IOException
 
- 
buildLocaleContextBuild a LocaleContext for the given request, exposing the request's primary locale as current locale.- Parameters:
- request- current HTTP request
- Returns:
- the corresponding LocaleContext, or nullif none to bind
- See Also:
 
- 
buildRequestAttributes@Nullable protected ServletRequestAttributes buildRequestAttributes(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable RequestAttributes previousAttributes) Build ServletRequestAttributes for the given request (potentially also holding a reference to the response), taking pre-bound attributes (and their type) into consideration.- Parameters:
- request- current HTTP request
- response- current HTTP response
- previousAttributes- pre-bound RequestAttributes instance, if any
- Returns:
- the ServletRequestAttributes to bind, or nullto preserve the previously bound instance (or not binding any, if none bound before)
- See Also:
 
- 
getUsernameForRequestDetermine the username for the given request.The default implementation takes the name of the UserPrincipal, if any. Can be overridden in subclasses. - Parameters:
- request- current HTTP request
- Returns:
- the username, or nullif none found
- See Also:
 
- 
doServiceprotected abstract void doService(HttpServletRequest request, HttpServletResponse response) throws Exception Subclasses must implement this method to do the work of request handling, receiving a centralized callback for GET, POST, PUT and DELETE.The contract is essentially the same as that for the commonly overridden doGetordoPostmethods of HttpServlet.This class intercepts calls to ensure that exception handling and event publication takes place. - Parameters:
- request- current HTTP request
- response- current HTTP response
- Throws:
- Exception- in case of any kind of processing failure
- See Also:
 
 
-