@RequestMapping(value = "treeanatomy", method = RequestMethod.GET)
@ResponseBody
public String getTreeAnatomy(HttpServletRequest request, String treeAnatomyMap, int realm) {
System.out.println("tree anatomy map in cms: " + treeAnatomyMap);
com.google.gson.JsonParser udmJson = new com.google.gson.JsonParser();
JsonElement surveyjson = udmJson.parse(treeAnatomyMap);
String wsId=surveyjson.getAsJsonObject().get("wsId").getAsString();
String treeType=surveyjson.getAsJsonObject().get("treeType").getAsString();
String langrealm=surveyjson.getAsJsonObject().get("langrealm").getAsString();
String snapnode=null;
if(surveyjson.getAsJsonObject().get("snapnode").getAsString().isEmpty()){
snapnode=surveyjson.getAsJsonObject().get("snapnode").getAsString();
}
Map<String , Object> mytreeMap = new HashMap<String, Object>();
// if (!isAuthenticated(id, jsessionId, Integer.valueOf(realm))) {
// model.addAttribute("message", "You are not authorized to access this application");
// return "home";
// }
// logger.info("Snapnode :" + snapnode +" : " + langrealm);
Node rootNode;
//model.addAttribute("userName", userSession.getUserName());
TeneTree tree = treeUtils.getTree(wsId, realm);
GsonBuilder gsonBuilder=new GsonBuilder();
gson = gsonBuilder.create();
// snapnode = "1397709503192";
if (Strings.isNullOrEmpty(snapnode)) {
rootNode = tree.getRootNode();
} else {
rootNode = tree.getNode(Long.valueOf(snapnode));
}
List<List<Node>> paths = treeUtils.getTreeAllPaths(rootNode,langrealm);
System.out.println("size is.. "+paths.size());
mytreeMap.put("paths", paths);
mytreeMap.put("treeId", wsId);
mytreeMap.put("snapnode", snapnode);
return gson.toJson(mytreeMap);
}
@RequestMapping(value = "treeanatomy{treeType}-{wsId}-{langrealm}.htm", method = RequestMethod.GET)
private ModelAndView returnTa(HttpServletRequest request, @PathVariable String wsId, @PathVariable String treeType, @PathVariable String langrealm,
@ModelAttribute("snapnode") String snapnode,String mAction){
SecurityContext context = SecurityContextHolder.getContext();
Authentication authentication = context.getAuthentication();
UserBean user = userService.getUserBean(authentication.getName());
System.out.println("treeAnatomy post data : " );
Map<String,Object> taPostMap = new HashMap<String,Object>();
taPostMap.put("wsId", wsId);
taPostMap.put("treeType", treeType);
taPostMap.put("langrealm", langrealm);
taPostMap.put("snapnode", snapnode);
System.out.println("ta postmap data : " + taPostMap);
RestTemplate restTemplate = new RestTemplate();
String adminResult = restTemplate.getForObject("http://localhost:8085/tenecms/cms/treeanatomy?treeAnatomyMap={taPostMap}&realm="+user.getRealmId(),
String.class,gson.toJson(taPostMap));
com.google.gson.JsonParser adminJson = new com.google.gson.JsonParser();
JsonElement adminjson = adminJson.parse(adminResult);
System.out.println("treeAnatomy post json data :" + adminjson);
ModelAndView model = new ModelAndView();
helper.updateCsrf(request, model);
model.setViewName("ta/addTa");
model.addObject("paths", adminjson.getAsJsonObject().get("paths"));
model.addObject("treeId",adminjson.getAsJsonObject().get("treeId"));
model.addObject("snapnode",adminjson.getAsJsonObject().get("snapnode"));
model.addObject("mAction", mAction);
return model;
}
}
org.springframework.web.util.NestedServletException:请求处理失败;嵌套异常是org.springframework.web.client.HttpServerErrorException:500 null org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) org.springframework.web.multipart.support.MultipartFilter.doFilterInternal(MultipartFilter.java:122) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 根本原因
org.springframework.web.client.HttpServerErrorException:500 null org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:94) org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667) org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620) org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580) org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:287) ssd.prod.nve.view.controllers.TreeAnatomyController.returnTa(TreeAnatomyController.java:52) sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) org.springframework.web.multipart.support.MultipartFilter.doFilterInternal(MultipartFilter.java:122) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)