Java Code Examples for org.springframework.ui.ExtendedModelMap#get()
The following examples show how to use
org.springframework.ui.ExtendedModelMap#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HandlerMethodInvoker.java From lams with GNU General Public License v2.0 | 6 votes |
private WebDataBinder resolveModelAttribute(String attrName, MethodParameter methodParam, ExtendedModelMap implicitModel, NativeWebRequest webRequest, Object handler) throws Exception { // Bind request parameter onto object... String name = attrName; if ("".equals(name)) { name = Conventions.getVariableNameForParameter(methodParam); } Class<?> paramType = methodParam.getParameterType(); Object bindObject; if (implicitModel.containsKey(name)) { bindObject = implicitModel.get(name); } else if (this.methodResolver.isSessionAttribute(name, paramType)) { bindObject = this.sessionAttributeStore.retrieveAttribute(webRequest, name); if (bindObject == null) { raiseSessionRequiredException("Session attribute '" + name + "' required - not found in session"); } } else { bindObject = BeanUtils.instantiateClass(paramType); } WebDataBinder binder = createBinder(webRequest, bindObject, name); initBinder(handler, name, binder, webRequest); return binder; }
Example 2
Source File: HandlerMethodInvoker.java From spring4-understanding with Apache License 2.0 | 6 votes |
private WebDataBinder resolveModelAttribute(String attrName, MethodParameter methodParam, ExtendedModelMap implicitModel, NativeWebRequest webRequest, Object handler) throws Exception { // Bind request parameter onto object... String name = attrName; if ("".equals(name)) { name = Conventions.getVariableNameForParameter(methodParam); } Class<?> paramType = methodParam.getParameterType(); Object bindObject; if (implicitModel.containsKey(name)) { bindObject = implicitModel.get(name); } else if (this.methodResolver.isSessionAttribute(name, paramType)) { bindObject = this.sessionAttributeStore.retrieveAttribute(webRequest, name); if (bindObject == null) { raiseSessionRequiredException("Session attribute '" + name + "' required - not found in session"); } } else { bindObject = BeanUtils.instantiateClass(paramType); } WebDataBinder binder = createBinder(webRequest, bindObject, name); initBinder(handler, name, binder, webRequest); return binder; }
Example 3
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindAllHandler(){ ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.list(model); List<User> users = (List<User>) model.get("users"); assertNotNull(users); assertEquals(2, users.size()); assertEquals(Long.valueOf(0), users.get(0).getId()); assertEquals("users/list", viewName); }
Example 4
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindOneHandler() throws NotFoundException { ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.show(1L, model); User user = (User) model.get("user"); assertNotNull(user); assertEquals(Long.valueOf(1), user.getId()); assertEquals("users/show", viewName); }
Example 5
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindAllHandler(){ ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.list(model); List<User> users = (List<User>) model.get("users"); assertNotNull(users); assertEquals(2, users.size()); assertEquals(Long.valueOf(0), users.get(0).getId()); assertEquals("users/list", viewName); }
Example 6
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindOneHandler() throws NotFoundException { ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.show(1L, model); User user = (User) model.get("user"); assertNotNull(user); assertEquals(Long.valueOf(1), user.getId()); assertEquals("users/show", viewName); }
Example 7
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindAllHandler(){ ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.list(model); List<User> users = (List<User>) model.get("users"); assertNotNull(users); assertEquals(2, users.size()); assertEquals(Long.valueOf(0), users.get(0).getId()); assertEquals("users/list", viewName); }
Example 8
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindOneHandler() throws NotFoundException { ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.show(1L, model); User user = (User) model.get("user"); assertNotNull(user); assertEquals(Long.valueOf(1), user.getId()); assertEquals("users/show", viewName); }
Example 9
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindAllHandler(){ final ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.list(model); List<User> users = (List<User>) model.get("users"); assertNotNull(users); assertEquals(2, users.size()); assertEquals(Long.valueOf(0), users.get(0).getId()); assertEquals("users/list", viewName); }
Example 10
Source File: UserControllerTest.java From Spring with Apache License 2.0 | 5 votes |
@Test public void testFindOneHandler() throws NotFoundException { final ExtendedModelMap model = new ExtendedModelMap(); String viewName = userController.show(1L, model); User user = (User) model.get("user"); assertNotNull(user); assertEquals(Long.valueOf(1), user.getId()); assertEquals("users/show", viewName); }