Example usage for org.springframework.web.servlet.view RedirectView RedirectView

List of usage examples for org.springframework.web.servlet.view RedirectView RedirectView

Introduction

In this page you can find the example usage for org.springframework.web.servlet.view RedirectView RedirectView.

Prototype

public RedirectView(String url, boolean contextRelative) 

Source Link

Document

Create a new RedirectView with the given URL.

Usage

From source file:org.duracloud.account.app.controller.RootConsoleHomeController.java

@RequestMapping(value = { "/", "" })
public ModelAndView getHome() {
    return new ModelAndView(new RedirectView(AccountsController.BASE_MAPPING, true));
}

From source file:com.healthcit.cacure.web.controller.ModuleCopyController.java

@RequestMapping(value = Constants.MODULE_COPY_URI, method = RequestMethod.POST)
public View onSubmit(@RequestParam(value = "moduleId", required = true) Long moduleId) {

    Module module = (Module) moduleMgr.getModule(moduleId);

    moduleMgr.copyModule(module);//w w w.  j  a  v  a 2  s.  com

    return new RedirectView(Constants.MODULE_LISTING_URI, true);
}

From source file:com.healthcit.cacure.web.controller.LogoutController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public View processLogout(HttpServletRequest request) {

    HttpSession session = request.getSession();

    try {//from w ww  .  j a  va  2 s.c  om
        session.removeAttribute(Constants.CREDENTIALS);
        session.invalidate();
    } catch (Exception ex) {
        //log exception
        log.error("Error in LogoutAction", ex);
    }

    return new RedirectView(Constants.HOME_URI, true);
}

From source file:org.openmrs.module.metadatasharing.web.utils.WebUtils.java

/**
 * Redirects to the given URL./*from  w w w  .  j a  v a2s. co m*/
 * 
 * @param url the URL to redirect
 * @param args the URL arguments. E.g. "group=123&id=2"
 * @param exposeModelAttributes the boolean stating if the model attributes should be exposed in
 *            the redirect URL
 * @return ModelAndView which redirects to the given page
 */
public static ModelAndView redirect(String url, String args, boolean exposeModelAttributes) {
    url = url + ".form";
    if (args != null) {
        url = url + "?" + args;
    }
    RedirectView redirect = new RedirectView(url, true);
    redirect.setExposeModelAttributes(exposeModelAttributes);
    return new ModelAndView(redirect);
}

From source file:com.healthcit.cacure.web.controller.LogoutControllerTest.java

@Test
public void testProcessLogout() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    UserCredentials userCredentials = new UserCredentials();
    userCredentials.setUserName("Testing");
    userCredentials.setPassword("TestPassword");
    MockHttpSession session = new MockHttpSession();
    session.setAttribute(Constants.CREDENTIALS, userCredentials);
    request.setSession(session);/*from   ww w .  j  a  va  2 s.c  om*/
    RedirectView actual = (RedirectView) logoutController.processLogout(request);
    RedirectView expected = new RedirectView(Constants.HOME_URI, true);
    Assert.assertNotNull(actual);
    Assert.assertNull(session.getAttribute(Constants.CREDENTIALS));
    Assert.assertEquals(expected.getUrl(), actual.getUrl());
}

From source file:de.thm.arsnova.controller.WelcomeController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public View home(final HttpServletRequest request) {
    return new RedirectView(mobileContextPath + "/", false);
}

From source file:gov.nih.nci.cabig.caaers.web.SampleController.java

@Override
protected ModelAndView processFinish(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    log.info("Sample controller finished");
    return new ModelAndView(new RedirectView("/pages/ae/sample", true));
}

From source file:org.sventon.web.ctrl.ListConfigurationsController.java

@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request,
        final HttpServletResponse response) throws Exception {

    final Map<String, Object> model = new HashMap<String, Object>();
    model.put("addedRepositories", application.getRepositoryNames());

    if (application.hasConfigurations()) {
        return new ModelAndView("config/listConfigs", model);
    } else {//from  w ww.  j  a va2s  .  c  o m
        return new ModelAndView(new RedirectView("/repos/config", true));
    }
}

From source file:com.healthcit.cacure.web.controller.ModuleEditControllerTest.java

@Test
public void testDelete() {
    Module inputModule = createModule(1l);
    moduleManager.deleteModule(inputModule);
    EasyMock.expectLastCall();/*from  w  w  w .  ja  v a2s .com*/
    EasyMock.replay(moduleManager);
    RedirectView expected = new RedirectView(Constants.MODULE_LISTING_URI, true);
    RedirectView actual = (RedirectView) moduleEditController.delete(inputModule);

    Assert.assertNotNull(actual);
    Assert.assertEquals(expected.getUrl(), actual.getUrl());
}

From source file:com.seajas.search.codex.social.controller.ConnectController.java

/**
 * {@inheritDoc}/*from   ww w. j av  a2s .c o  m*/
 */
@Override
protected RedirectView connectionStatusRedirect(final String providerId, final NativeWebRequest request) {
    return new RedirectView("/identities.html", true);
}