@RequestMapping(value = “/SINGLE_SIGN_LOGIN”,method = RequestMethod.GET)
public void singleSignLogin(@RequestParam String ticketId, HttpServletResponse resp, HttpServletRequest request) throws Exception {
代码逻辑省略…
//请求重定向,使用域名地址,使用ip地址跳转获取不到cookies信息
resp.sendRedirect( indexUrl);
} catch (Exception e) {
resp.setCharacterEncoding(“utf-8”);
pw=resp.getWriter();
pw.write(“权限异常,请联系运维人员”);
}
}
亲测,有效!
JAVA中后台try/catch返回前端错误信息
最新推荐文章于 2023-03-21 11:18:18 发布