Redirecting to another sub-domain with added flash attributes (Redirectattributes) does not work

Asked

Viewed 26 times

1

My question is related to adding attributes in the interface RedirectAttributes. I’m adding two attributes flash redirecting, but redirecting does not just change the URI, but the sub-domain as can be seen in the method below:

@RequestMapping(value = "/access-agency", method = RequestMethod.GET)
public String acessLoginPage(@RequestParam(required = true) String email, final RedirectAttributes redirectAttributes, HttpServletRequest request){
    Login login = loginFacade.findByEmail(email);
    Agency agency = agencyFacade.findAgencyByTenantId(login.getTenantId());

    redirectAttributes.addFlashAttribute("inputFieldReadOnly", Boolean.TRUE);
    redirectAttributes.addFlashAttribute("employeeEmail", email);
    return "redirect:http://" + agency.getSubdomain() + "."+ request.getServerName().replaceAll(".*\\.(?=.*\\.)", "") + ":" + request.getServerPort() + request.getContextPath()+"/login";  
}

Unfortunately it doesn’t work! Can anyone tell me if it’s because I’m redirecting to another sub-domain and the

Redirectattributes

only works with changing URI?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.