/** * Method responsible for generating form for reporting errors. * @param elementId * @return */ public Map<String, Object> getForm(String elementId) { Map<String, Object> result = new HashMap<String, Object>(); try { Map<String, Object> model = new HashMap<String, Object>(); WebContext context = WebContextFactory.get(); String captchaId = captchaIdGenerator.getId(context.getSession().getId()); model.put("captchaId", captchaId); model.put("extId", elementId); model.put("logged", false); model.put("timestamp", (new Date()).getTime()); context.getHttpServletRequest().setAttribute("viewModel", model); String html = context.forwardToString(forcedViewName); result.put(DWRConstants.CONTENT, html); } catch (Exception e) { log.warn("Exception occurred when rendering DWR error form for element " + elementId, e); result.put(DWRConstants.ERROR, messageSource.getMessage( MessageConstants.DWR_NO_DATA, null, LocaleContextHolder.getLocale())); } return result; }
private Map<String, Object> prepareDWRModelAndView(StyledCitationVO citationView) { Map<String, Object> model = new HashMap<>(); if (citationView != null) { model.put("styledCitation", citationView); try { WebContext context = WebContextFactory.get(); final HttpServletRequest httpServletRequest = context.getHttpServletRequest(); model.put("locale", localeResolver.resolveLocale(httpServletRequest).getLanguage()); httpServletRequest.setAttribute("content", model); model.put(DWRConstants.CONTENT, context.forwardToString(view)); } catch (ServletException e) { throw new SystemException(Modules.CATALOG, "Servlet error", e); } catch (IOException e) { throw new SystemException(Modules.CATALOG, "IO error", e); } } noDWRDataMessage(model); return model; }
public Map<String, Object> getDetails(String elementId) { Map<String, Object> result = new HashMap<String, Object>(); try { String viewName; if (elementId == null || "".equals(elementId)) throw new SystemException(Modules.DETAILS, "Parameter id value not provided."); elementHandler.setId(elementId); String resolvedViewName = elementHandler.buildView(); viewName = forcedViewName != null ? forcedViewName : resolvedViewName; WebContext context = WebContextFactory.get(); context.getHttpServletRequest().setAttribute("viewModel", elementHandler.getModel()); String html = context.forwardToString(viewName); result.put(DWRConstants.CONTENT, html); } catch (Exception e) { log.warn("Exception occurred when rendering DWR Part for element " + elementId, e); result.put(DWRConstants.ERROR, messageSource.getMessage(MessageConstants.DWR_NO_DATA, null, LocaleContextHolder.getLocale())); } return result; }
model); result.put(DWRConstants.CONTENT, context.forwardToString(view));
model.put("timestamp", (new Date()).getTime()); context.getHttpServletRequest().setAttribute("viewModel", model); String html = context.forwardToString(forcedViewName); result.put(DWRConstants.CONTENT, html); } catch (Exception e) {