List of usage examples for org.springframework.web.servlet ModelAndView getViewName
@Nullable
public String getViewName()
From source file:org.impalaframework.extension.mvc.util.RequestModelHelper.java
/** * Returns whether a particular {@link ModelAndView} represents a redirect *///from ww w . j a v a 2 s .co m public static boolean isRedirect(ModelAndView modelAndView) { boolean isRedirect = false; if (modelAndView.getView() instanceof RedirectView || (modelAndView.getViewName() != null && modelAndView.getViewName().startsWith("redirect:"))) { isRedirect = true; } return isRedirect; }
From source file:infowall.web.controller.HelloWorldControllerTest.java
@Test public void testHelloWorld() throws Exception { HelloWorldController controller = new HelloWorldController(); ModelAndView mav = controller.helloWorld(123l); assertThat(mav.getViewName(), is("hello")); }
From source file:com.acc.storefront.interceptors.BeforeViewHandlerInterceptor.java
protected boolean isSupportedView(final ModelAndView modelAndView) { return modelAndView.getViewName() != null && !isRedirectView(modelAndView); }
From source file:com.acc.storefront.interceptors.BeforeViewHandlerInterceptor.java
protected boolean isRedirectView(final ModelAndView modelAndView) { final String viewName = modelAndView.getViewName(); return viewName != null && viewName.startsWith("redirect:"); }
From source file:py.gov.asuncion.springapp.web.HelloControllerTests.java
@Test public void testHandleRequestView() throws Exception { HelloController controller = new HelloController(); ModelAndView modelAndView = controller.handleRequest(null, null); assertEquals("hello", modelAndView.getViewName()); assertNotNull(modelAndView.getModel()); String nowValue = (String) modelAndView.getModel().get("now"); assertNotNull(nowValue);/* w w w . j ava 2 s . c om*/ }
From source file:edu.wisc.doit.tcrypt.EncryptControllerTest.java
@Test public void shouldHandleSlashHandleMapping() throws Exception { ModelAndView handleRequest = encryptController.encryptTextInit(""); assertEquals(handleRequest.getViewName(), "encryptToken"); }
From source file:ch.silviowangler.dox.web.HomeControllerTest.java
@Test public void homeScreenModelMustContainTwoDefaultSettings() { final ModelAndView modelAndView = controller.homeScreen(""); assertThat(modelAndView.getViewName(), is("base.definition.angularjs")); assertHomeScreenModel(modelAndView.getModelMap()); }
From source file:org.parancoe.basicWebApp.controllers.HomeControllerTest.java
public void testWelcome() throws Exception { resetRequestAndResponse();/* ww w .j a va2s. c o m*/ req.setMethod("GET"); req.setRequestURI("/home/welcome.html"); req = new MockHttpServletRequest("GET", "/home/welcome.html"); ModelAndView mv = methodHandler.handle(req, res, controller); assertEquals("welcome", mv.getViewName()); assertNotNull(mv.getModel().get("something")); }
From source file:com.github.carlomicieli.nerdmovies.config.ImplicitObjectsInterceptor.java
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null && !modelAndView.getViewName().startsWith("redirect:")) { FilterInvocation filterInvocation = new FilterInvocation(request, response, new FilterChain() { public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { throw new UnsupportedOperationException(); }/* www .j a v a2s . c om*/ }); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); WebSecurityExpressionRoot sec = new WebSecurityExpressionRoot(authentication, filterInvocation); sec.setTrustResolver(new AuthenticationTrustResolverImpl()); modelAndView.getModel().put("sec", sec); } }
From source file:se.vgregion.mobile.controllers.FacilitiesControllerTest.java
@Test public void index() throws IOException { ModelAndView mav = controller.index(); Assert.assertEquals("facilities", mav.getViewName()); }