private void publishRequestHandledEvent(HttpServletRequest request, HttpServletResponse response, long startTime, @Nullable Throwable failureCause) { if (this.publishEvents && this.webApplicationContext != null) { // Whether or not we succeeded, publish an event. long processingTime = System.currentTimeMillis() - startTime; this.webApplicationContext.publishEvent( new ServletRequestHandledEvent(this, request.getRequestURI(), request.getRemoteAddr(), request.getMethod(), getServletConfig().getServletName(), WebUtils.getSessionId(request), getUsernameForRequest(request), processingTime, failureCause, response.getStatus())); } }
private void publishRequestHandledEvent(HttpServletRequest request, HttpServletResponse response, long startTime, @Nullable Throwable failureCause) { if (this.publishEvents && this.webApplicationContext != null) { // Whether or not we succeeded, publish an event. long processingTime = System.currentTimeMillis() - startTime; this.webApplicationContext.publishEvent( new ServletRequestHandledEvent(this, request.getRequestURI(), request.getRemoteAddr(), request.getMethod(), getServletConfig().getServletName(), WebUtils.getSessionId(request), getUsernameForRequest(request), processingTime, failureCause, response.getStatus())); } }
@Test public void testSessionTimeout() throws Exception { MockHttpSession session = new MockHttpSession(); assertEquals(0, session.getMaxInactiveInterval()); webApplicationContext.publishEvent(new HttpSessionCreatedEvent(session)); assertEquals(timeout, session.getMaxInactiveInterval()); }
@Test public void testSessionChangedTimeout() throws Exception { timeoutSetter.setTimeout(300); MockHttpSession session = new MockHttpSession(); assertEquals(0, session.getMaxInactiveInterval()); webApplicationContext.publishEvent(new HttpSessionCreatedEvent(session)); assertNotNull("session should exist", session); assertEquals(300, session.getMaxInactiveInterval()); } }
private void publishRequestHandledEvent( HttpServletRequest request, HttpServletResponse response, long startTime, Throwable failureCause) { if (this.publishEvents) { // Whether or not we succeeded, publish an event. long processingTime = System.currentTimeMillis() - startTime; int statusCode = (responseGetStatusAvailable ? response.getStatus() : -1); this.webApplicationContext.publishEvent( new ServletRequestHandledEvent(this, request.getRequestURI(), request.getRemoteAddr(), request.getMethod(), getServletConfig().getServletName(), WebUtils.getSessionId(request), getUsernameForRequest(request), processingTime, failureCause, statusCode)); } }
/** * Reload the references of all the existing entities. * * @return the result code. */ public String reloadEntitiesReferences() { try { ReloadingEntitiesReferencesEvent event = new ReloadingEntitiesReferencesEvent(); WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(this.getRequest()); wac.publishEvent(event); logger.info("Reloading entity references started"); } catch (Throwable t) { logger.error("error in reloadEntitiesReferences", t); return FAILURE; } return SUCCESS; }
/** * Reload the references of all the existing entities. * * @return the result code. */ public String reloadEntitiesReferences() { try { ReloadingEntitiesReferencesEvent event = new ReloadingEntitiesReferencesEvent(); WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(this.getRequest()); wac.publishEvent(event); logger.info("Reloading entity references started"); } catch (Throwable t) { logger.error("error in reloadEntitiesReferences", t); return FAILURE; } return SUCCESS; }
@Override public String reloadEntitiesReferences() { try { ReloadingEntitiesReferencesEvent event = new ReloadingEntitiesReferencesEvent(); WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(this.getRequest()); wac.publishEvent(event); ApsSystemUtils.getLogger().info("Reloading entity references started"); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "reloadEntitiesReferences"); return FAILURE; } return SUCCESS; }
applicationContext.publishEvent(new ServletRequestHandledEvent( this, request.getRequestURI(), request.getRemoteAddr(), request.getMethod(), "SpringMvcTinyProcessor", WebUtils