Commit dcf2eb92 authored by Matija Obreza's avatar Matija Obreza
Browse files

Disable RequestTrackingInterceptor

parent a504bb40
......@@ -19,6 +19,7 @@ package org.genesys2.spring;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -30,7 +31,7 @@ public class AddStuffInterceptor implements HandlerInterceptor {
@Autowired
private RequestTracker requestTracker;
@Value("${build.name}")
private String buildName;
......@@ -48,7 +49,12 @@ public class AddStuffInterceptor implements HandlerInterceptor {
final long endTime = System.currentTimeMillis();
final long executeTime = endTime - startTime;
arg0.setAttribute("springExecuteTime", executeTime);
arg0.setAttribute("lastGet", requestTracker.getLastGet());
try {
arg0.setAttribute("lastGet", requestTracker.getLastGet());
} catch (BeanCreationException e) {
// No requestTracker bean
}
}
@Override
......
......@@ -23,11 +23,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
@Component
//@Component
public class RequestTrackingInterceptor implements HandlerInterceptor {
private static final Log LOG = LogFactory.getLog(RequestTrackingInterceptor.class);
......
......@@ -57,8 +57,8 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
@Autowired
private AddStuffInterceptor addStuffInterceptor;
@Autowired
@Autowired(required = false)
private RequestTrackingInterceptor requestTrackingInterceptor;
@Override
......@@ -90,7 +90,9 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
themeChangeInterceptor.setParamName("theme");
registry.addInterceptor(themeChangeInterceptor);
registry.addInterceptor(requestTrackingInterceptor);
if (requestTrackingInterceptor != null) {
registry.addInterceptor(requestTrackingInterceptor);
}
registry.addInterceptor(addStuffInterceptor);
}
......@@ -124,7 +126,7 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
@Bean
public RequestAttributeLocaleResolver localeResolver() {
final Set<String> supportedLocales = new HashSet<String>();
final Set<String> supportedLocales = new HashSet<String>();
supportedLocales.add("en");
supportedLocales.add("ar");
supportedLocales.add("de");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment