Authored by 胡古飞

fix ControllerCostInterceptor

... ... @@ -8,8 +8,6 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.core.NamedThreadLocal;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
... ... @@ -20,7 +18,7 @@ import com.yoho.search.service.downgrade.DownGradeService;
import com.yoho.search.service.monitor.PerformanceMonitor;
import com.yoho.search.service.utils.HttpServletRequestUtils;
public class ControllerCostInterceptor implements HandlerInterceptor, ApplicationEventPublisherAware {
public class ControllerCostInterceptor implements HandlerInterceptor{
private static final Logger CONTROLLER_COST = LoggerFactory.getLogger("CONTROLLER_COST");
... ... @@ -31,13 +29,6 @@ public class ControllerCostInterceptor implements HandlerInterceptor, Applicatio
@Autowired
private DownGradeService downGradeService;
ApplicationEventPublisher publisher;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handle) throws Exception {
long beginTime = System.currentTimeMillis();// 1、开始时间
... ... @@ -97,9 +88,9 @@ public class ControllerCostInterceptor implements HandlerInterceptor, Applicatio
sb.append(request.getRequestURI());
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
if (paramMap != null && !paramMap.isEmpty()) {
sb.append("?");
sb.append('?');
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
sb.append(entry.getKey()).append('=').append(entry.getValue()).append('&');
}
sb.deleteCharAt(sb.length() - 1);
}
... ...