/** Cleans up a request of thread locals */ public void cleanupRequest(HttpServletRequest request) { Integer counterVal = (Integer) request.getAttribute(CLEANUP_RECURSION_COUNTER); if (counterVal != null) { counterVal -= 1; request.setAttribute(CLEANUP_RECURSION_COUNTER, counterVal); if (counterVal > 0) { if (log.isDebugEnabled()) { log.debug("skipping cleanup counter=" + counterVal); } return; } } // always clean up the thread request, even if an action hasn't been executed try { dispatcher.cleanUpRequest(request); } catch (IOException e) { if (LOG.isWarnEnabled()) { LOG.warn( "Cannot clean up the request, some files can still remain in #0 after upload!", e, StrutsConstants.STRUTS_MULTIPART_SAVEDIR); } } finally { ActionContext.setContext(null); Dispatcher.setInstance(null); } }