|
|
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.io.support.ResourcePropertySource;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
|
|
|
@@ -17,16 +18,22 @@ import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.shiro.filter.ShiroFilterUtils;
|
|
|
|
|
|
-public class SystemExceptionResolver extends SimpleMappingExceptionResolver {
|
|
|
+public class SystemExceptionResolver extends SimpleMappingExceptionResolver{
|
|
|
@Resource(name = "errorResource")
|
|
|
private ResourcePropertySource errorResource;
|
|
|
-
|
|
|
+ @Value(value = "${app.name}")
|
|
|
+ private String appName;
|
|
|
@Autowired
|
|
|
private ShiroFilterUtils shiroFilterUtils;
|
|
|
|
|
|
@Override
|
|
|
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
|
|
|
Exception ex) {
|
|
|
+ /*if(request.getHeader("User-Agent") != null && request.getHeader("User-Agent").indexOf(appName) > -1){
|
|
|
+ setExceptionMappings(new Properties());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ */
|
|
|
// Expose ModelAndView for chosen error view.
|
|
|
String viewName = determineViewName(ex, request);
|
|
|
|
|
|
@@ -85,4 +92,5 @@ public class SystemExceptionResolver extends SimpleMappingExceptionResolver {
|
|
|
public void setErrorResource(ResourcePropertySource errorResource) {
|
|
|
this.errorResource = errorResource;
|
|
|
}
|
|
|
+
|
|
|
}
|