List of usage examples for org.springframework.web.servlet.view RedirectView RedirectView
public RedirectView(String url, boolean contextRelative)
From source file:com.healthcit.cacure.web.controller.QuestionLibraryEditController.java
@RequestMapping(method = RequestMethod.GET, params = Constants.DELETE_CMD_PARAM) public View delete(@ModelAttribute(COMMAND_NAME) QuestionsLibraryModule module) { if (!isEditable(module)) { // The UI should never get the user here throw new UnauthorizedException("The module is not editable in the current context"); }//from w w w.j av a2 s . c om moduleMgr.deleteModule(module); return new RedirectView(Constants.LIBRARY_MANAGE_URI, true); }
From source file:cherry.sqlapp.controller.login.LoginControllerImpl.java
@Override public ModelAndView loggedOut(Locale locale, SitePreference sitePref, HttpServletRequest request, RedirectAttributes redirAttr) {/*from w w w . jav a 2s . co m*/ redirAttr.addFlashAttribute(PathDef.METHOD_LOGGED_OUT, true); UriComponents uc = fromMethodCall(on(LoginController.class).init(locale, sitePref, request)).build(); ModelAndView mav = new ModelAndView(); mav.setView(new RedirectView(uc.toUriString(), true)); return mav; }
From source file:org.duracloud.account.app.controller.AbstractCrudController.java
@RequestMapping(value = NEW_MAPPING, method = RequestMethod.POST) @Transactional/*from w ww. j a va 2s .co m*/ public ModelAndView create(@ModelAttribute("form") @Valid T form, BindingResult bindingResult, Model model, RedirectAttributes redirectAttributes) { boolean hasErrors = bindingResult.hasErrors(); if (hasErrors) { return new ModelAndView(getNewViewId()); } create(form); log.info("created entity: {}", form); setSuccessFeedback(createSuccessMessage(), redirectAttributes); return new ModelAndView(new RedirectView(getBaseViewId(), true)); }
From source file:com.healthcit.cacure.web.controller.ModuleListControllerTest.java
@SuppressWarnings("unchecked") @Test//from w w w . ja va 2 s .co m public void testDeleteFormWithoutDelete() { EasyMock.expect(moduleManager.getAllModules()).andReturn(createMockModules()); EasyMock.replay(moduleManager); RedirectView expected = new RedirectView(Constants.MODULE_LISTING_URI, true); RedirectView actual = (RedirectView) moduleListController.deleteModule(1l, false); Assert.assertNotNull(actual); Assert.assertEquals(expected.getUrl(), actual.getUrl()); }
From source file:com.healthcit.cacure.web.controller.FormListControllerTest.java
@Test public void testSwapFormsForUp() { //formManager.moveFormInModule(1l, ItemOrderingAction.UP); EasyMock.expectLastCall();// w w w . j a va2 s . com EasyMock.expect(formManager.getModuleForms(1l)).andReturn(createMockQuestionForms()); EasyMock.replay(formManager); RedirectView expected = new RedirectView(Constants.QUESTIONNAIREFORM_LISTING_URI + "?moduleId=" + 1l, true); //RedirectView actual = (RedirectView) formListController.swapForms(1l, 1l, 1); //Assert.assertNotNull(actual); //Assert.assertEquals(expected.getUrl(), actual.getUrl()); }
From source file:com.healthcit.cacure.web.controller.ModuleEditControllerTest.java
@Test public void testOnSubmitForCreate() { Module inputModule = createModule(null); EasyMock.expect(moduleManager.addNewModule(inputModule)).andReturn(createModule(inputModule.getId())); EasyMock.replay(moduleManager);/*from ww w . j a v a 2s .c o m*/ RedirectView expected = new RedirectView(Constants.MODULE_LISTING_URI, true); RedirectView actual = (RedirectView) moduleEditController.onSubmit(inputModule); Assert.assertNotNull(actual); Assert.assertEquals(expected.getUrl(), actual.getUrl()); }
From source file:com.tunisbank.service.AdminControllers.java
@RequestMapping("/admin/addgroupe") public ModelAndView addGroupe(HttpServletRequest request) { Groupe groupe = new Groupe(); groupe.setName(request.getParameter("name")); groupe.setDisc(request.getParameter("disc")); groupesDAO.save(groupe);//from w ww .jav a 2s . co m Map model = new HashMap(); model.put("groupes", groupesDAO.getAll()); return new ModelAndView(new RedirectView("../admin/groupe.html", true), model); }
From source file:pt.ist.fenix.ui.spring.BookmarksController.java
@RequestMapping("/add/{category}") public RedirectView addBookmark(@PathVariable Category category) { FenixFramework.atomic(() -> {/* w ww. j av a 2s . c om*/ Authenticate.getUser().addBookmarks(category); }); return new RedirectView("/learning/bookmarks", true); }
From source file:org.sventon.web.ctrl.template.ExportController.java
@Override protected ModelAndView svnHandle(final SVNConnection connection, final BaseCommand cmd, final long headRevision, final UserRepositoryContext userRepositoryContext, final HttpServletRequest request, final HttpServletResponse response, final BindException exception) throws Exception { final MultipleEntriesCommand command = (MultipleEntriesCommand) cmd; final long pegRevision = command.hasPegRevision() ? command.getPegRevision().getNumber() : command.getRevisionNumber(); if (userRepositoryContext.getIsWaitingForExport()) { throw new IllegalStateException("Export already in progress"); }//from w w w . ja va 2 s .co m final UUID uuid = exportExecutor.submit(command, connection, pegRevision); userRepositoryContext.setExportUuid(uuid); userRepositoryContext.setIsWaitingForExport(true); // Add the redirect URL parameters final Map<String, String> model = new HashMap<String, String>(); model.put("revision", command.getRevision().toString()); return new ModelAndView(new RedirectView(command.createListUrl(), true), model); }
From source file:org.fenixedu.spaces.ui.MyOccupationRequestController.java
@RequestMapping(value = "create", method = RequestMethod.POST) public RedirectView createRequest(@ModelAttribute OccupationRequestBean bean, BindingResult errors) { occupationService.createRequest(bean); return new RedirectView("/spaces/occupations/requests/my", true); }