Code example for WebRequest
Methods: getAttribute, setAttribute
* Obtain the {@link WebAsyncManager} for the current request, or if not
* found, create and associate it with the request.
*/
public static WebAsyncManager getAsyncManager(WebRequest webRequest) {
int scope = RequestAttributes.SCOPE_REQUEST;
WebAsyncManager asyncManager = (WebAsyncManager) webRequest.getAttribute(WEB_ASYNC_MANAGER_ATTRIBUTE, scope);
if (asyncManager == null) {
asyncManager = new WebAsyncManager();
webRequest.setAttribute(WEB_ASYNC_MANAGER_ATTRIBUTE, asyncManager, scope);
}
return asyncManager;
}
/**
* Create an AsyncWebRequest instance. By default an instance of
* {@link StandardServletAsyncWebRequest} is created if running in Servlet
* 3.0 (or higher) environment or as a fallback, an instance of
* {@link NoSupportAsyncWebRequest} is returned.
*
* @param request the current request
