java springboot 方法返回 header, javascript 可访问
var servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); var response = servletRequestAttributes.getResponse(); var filename = "a.xls"; response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode( filename, "UTF-8"));
桂棹兮兰桨,击空明兮溯流光。