Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) SiteWhere, LLC. All rights reserved. http://www.sitewhere.com
  *
  * The software in this package is published under the terms of the CPAL v1.0
  * license, a copy of which has been included with this distribution in the
  * LICENSE.txt file.
  */
 package com.sitewhere.web;
 
Filter that prints the response time out to the console.

Author(s):
Derek
public class ResponseTimerFilter extends OncePerRequestFilter {

Static logger instance
	private static Logger LOGGER = Logger.getLogger(ResponseTimerFilter.class);
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.web.filter.OncePerRequestFilter#doFilterInternal(javax.servlet.http.HttpServletRequest
	 * , javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)
	 */
	protected void doFilterInternal(HttpServletRequest requestHttpServletResponse response,
		long start = System.currentTimeMillis();
		chain.doFilter(requestresponse);
		long time = System.currentTimeMillis() - start;
		.info("Call for " + request.getMethod() + " to '" + request.getRequestURL() + "' returned in "
time + " ms.");
	}
New to GrepCode? Check out our FAQ X