鉴于这种相对重定向到另一个控制器的方法:
@Controller
@RequestMapping("/someController")
public class MyController {
@RequestMapping("/redirme")
public String processForm(ModelMap model) {
return "redirect:/someController/somePage";
}
}
鉴于我在拦截器中,如何模拟相同的相对重定向?
public class MyInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
response.sendRedirect("/someController/somePage");
return false;
}
}
现在有了拦截器,当我真的想在 application.com/deployment/someController/somePage 时,我将在 application.com/someController/somePage 结束。当然必须有一个“弹簧”解决方案吗?