List of usage examples for org.springframework.web.context.request ServletRequestAttributes requestCompleted
public void requestCompleted()
From source file:io.neba.core.spring.web.filter.NebaRequestContextFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { ServletRequestAttributes attributes = createServletRequestAttributes(request); initContextHolders(request, attributes); try {//w w w . java 2 s.c o m filterChain.doFilter(request, response); } finally { resetContextHolders(); if (logger.isDebugEnabled()) { logger.debug("Cleared thread-bound request context: " + request); } attributes.requestCompleted(); } }
From source file:org.springframework.web.context.request.RequestContextListener.java
public void requestDestroyed(ServletRequestEvent requestEvent) { ServletRequestAttributes attributes = (ServletRequestAttributes) requestEvent.getServletRequest() .getAttribute(REQUEST_ATTRIBUTES_ATTRIBUTE); ServletRequestAttributes threadAttributes = (ServletRequestAttributes) RequestContextHolder .getRequestAttributes();/* w w w. j av a 2 s .c o m*/ if (threadAttributes != null) { // We're assumably within the original request thread... if (attributes == null) { attributes = threadAttributes; } RequestContextHolder.setRequestAttributes(null); LocaleContextHolder.setLocale(null); } if (attributes != null) { attributes.requestCompleted(); if (logger.isDebugEnabled()) { logger.debug("Cleared thread-bound request context: " + requestEvent.getServletRequest()); } } }