0
我想添加一個http標頭並重定向到外部url。但不知怎的,標題值在外部url上被讀爲null。我知道我們可以傳遞屬性,但我需要的是一個http標頭spring mvc - 在重定向期間保留http標頭
@RequestMapping("/sso")
public String sso(@RequestParam("username") final String username,
@RequestParam("password") final String password,
@RequestParam("TARGET") final String TARGET,
HttpServletResponse response, Model model) {
// validate user
// set response token
response.addHeader("token", "abcd1234xyz56sa");
// return "success";
return "redirect:" + TARGET;
}
這裏的TARGET是一個不同的應用程序,所以我不認爲我可以使用會話。考慮在TARGET應用程序中添加入站攔截器或過濾器。 – skonka 2014-09-22 05:21:24