use of org.springframework.web.servlet.mvc.ParameterizableViewController in project cas by apereo.
the class CasApplicationContextConfiguration method rootController.
@Bean
protected Controller rootController() {
return new ParameterizableViewController() {
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String queryString = request.getQueryString();
final String url = request.getContextPath() + "/login" + (queryString != null ? '?' + queryString : StringUtils.EMPTY);
return new ModelAndView(new RedirectView(response.encodeURL(url)));
}
};
}
use of org.springframework.web.servlet.mvc.ParameterizableViewController in project spring-framework by spring-projects.
the class ViewControllerRegistryTests method getController.
private ParameterizableViewController getController(String path) {
Map<String, ?> urlMap = getHandlerMapping().getUrlMap();
ParameterizableViewController controller = (ParameterizableViewController) urlMap.get(path);
assertNotNull(controller);
return controller;
}
use of org.springframework.web.servlet.mvc.ParameterizableViewController in project spring-framework by spring-projects.
the class ViewControllerRegistryTests method addViewController.
@Test
public void addViewController() {
this.registry.addViewController("/path").setViewName("viewName");
ParameterizableViewController controller = getController("/path");
assertEquals("viewName", controller.getViewName());
assertNull(controller.getStatusCode());
assertFalse(controller.isStatusOnly());
assertNotNull(controller.getApplicationContext());
}
Aggregations