List of usage examples for org.springframework.ui ModelMap ModelMap
public ModelMap(String attributeName, @Nullable Object attributeValue)
From source file:cz.muni.fi.mir.controllers.ComparisonController.java
@RequestMapping(value = "/") public ModelAndView listDifference(@RequestParam(value = "appRunsID") Long[] appRunsID) { if (appRunsID == null || appRunsID.length != 2) { throw new IllegalArgumentException("Wrong comparison request size."); }/*from w ww.j av a 2s . c o m*/ ModelMap mm = new ModelMap("compareDiff", true); mm.addAttribute("comparedResult", comparisonService.compare(idToARun(appRunsID[0]), idToARun(appRunsID[1]))); mm.addAttribute("applicationRun1", applicationRunService.getApplicationRunByID(appRunsID[0])); mm.addAttribute("applicationRun2", applicationRunService.getApplicationRunByID(appRunsID[1])); return new ModelAndView("comparisonResult", mm); }
From source file:cz.muni.fi.mir.controllers.AnnotationValueController.java
@RequestMapping(value = { "/", "/list", "/list/" }) public ModelAndView list() { return new ModelAndView("annotationv_list", new ModelMap("annotationValueList", annotationValueSerivce.getAll())); }
From source file:cz.muni.fi.mir.controllers.AnnotationValueController.java
@RequestMapping(value = { "/delete/{id}", "/delete/{id}/" }) public ModelAndView delete(@PathVariable Long id) { AnnotationValue av = new AnnotationValue(); av.setId(id);/*ww w . j a v a2 s . co m*/ annotationValueSerivce.deleteAnnotationValue(av); return new ModelAndView("annotationv_list", new ModelMap("annotationValueList", annotationValueSerivce.getAll())); }
From source file:com.gvmax.web.api.AdminAPI.java
@RequestMapping(value = "/stats", method = RequestMethod.GET) @Timed// w ww.j a va 2 s . co m @ExceptionMetered public ModelMap stats(@RequestParam(value = "pin", required = true) String pin, HttpSession session, HttpServletResponse resp) { User user = getUser(service, session, pin); if (user != null && user.getEmail().equals(adminAccount)) { return new ModelMap("stats", service.getStats()); } return null; }
From source file:cz.muni.fi.mir.controllers.AnnotationValueController.java
@RequestMapping(value = { "/edit/{id}", "/edit/{id}/" }, method = RequestMethod.GET) public ModelAndView edit(@PathVariable Long id) { AnnotationValue av = annotationValueSerivce.getAnnotationValueByID(id); ModelMap mm = new ModelMap("annotationValueForm", mapper.map(av, AnnotationValueForm.class)); return new ModelAndView("annotationv_edit", mm); }
From source file:com.gvmax.web.api.WebAPI.java
@RequestMapping(value = "/send", method = RequestMethod.POST) @Timed/*from w ww . j a va 2s . c o m*/ @ExceptionMetered public ModelMap send(@RequestParam(value = "pin", required = false) String pin, @RequestParam(value = "number") String number, @RequestParam(value = "text") String text, @RequestParam(value = "callbackUrl", required = false) String callbackUrl, HttpSession session, HttpServletResponse resp) { try { User user = APIUtil.getUser(service, session, pin); if (user == null) { APIUtil.invalidCredentials(resp); return null; } String id = service.sendSMS(user.getPin(), number, text, callbackUrl); return new ModelMap("id", id); } catch (DataAccessException e) { APIUtil.internalError(e, resp); } catch (IOException e) { APIUtil.internalError(e, resp); } return null; }
From source file:com.gvmax.web.api.XmppAPI.java
@RequestMapping(value = "/xmppIn", method = RequestMethod.POST) @Timed/* w ww. j a v a 2 s . c o m*/ @ExceptionMetered public ModelMap xmppIn(@RequestParam(value = "reqId") String reqId, @RequestParam(value = "from") String from, @RequestParam(value = "to") String to, @RequestParam(value = "msg") String msg, HttpSession session, HttpServletResponse resp) { try { Enc enc = new Enc(relayEncKey, 128); //reqId = enc.decrypt(reqId); from = enc.decrypt(from); to = enc.decrypt(to); msg = enc.decrypt(msg); if (from == null || to == null || msg == null) { internalError(new Exception("Invalid request"), resp); return null; } XMPPAction action = new XMPPAction(from, to.split(","), msg); service.sendXMPPIn(action); return new ModelMap("result", "ok"); } catch (IOException e) { internalError(e, resp); } return null; }
From source file:com.gvmax.web.api.AdminAPI.java
@RequestMapping(value = "/blacklist", method = RequestMethod.GET) @Timed/*from w ww.j a v a 2 s . c o m*/ @ExceptionMetered public ModelMap blacklist(@RequestParam(value = "pin", required = true) String pin, @RequestParam(value = "value", required = true) String value, HttpSession session, HttpServletResponse resp) { User user = getUser(service, session, pin); if (user != null && user.getEmail().equals(adminAccount)) { service.blacklist(value); return new ModelMap("status", "ok"); } return null; }
From source file:com.jeans.iservlet.controller.impl.AssetsController.java
/** * ?idtype?/*from w ww. j av a 2s.c o m*/ * * @return */ @RequestMapping(method = RequestMethod.POST, value = "/load-asset") @ResponseBody public ModelMap loadAsset(@RequestParam long id, @RequestParam byte type) { return type == AssetConstants.HARDWARE_ASSET ? new ModelMap("data", ViewFactory.createView(Hardware.class, HardwareView.class, assetService.loadHardware(id))) : new ModelMap("data", ViewFactory.createView(Software.class, SoftwareView.class, assetService.loadSoftware(id))); }
From source file:app.web.AbstractController.java
@ExceptionHandler(Exception.class) public ModelMap handleAllExceptions(Exception e) { if (!ConfigurationUtils.getString("mode").startsWith("DEV")) { EmailUtils.send(e.getMessage(), Arrays.toString(e.getStackTrace()).replaceAll(", ", "\n")); }//from ww w . j a va 2s. c o m return new ModelMap("exception", e); }