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

Disable RequestTrackingInterceptor

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