当我在 Controller 方法中写入时:
response.setHeader("Content-Disposition", "attachment; filename=mockDump.csv");
效果很好。
但是当我添加 @RequestMapping
参数 headers = {"Content-Disposition=attachment", "filename=mockDump.csv"}
方法不调用。
为什么?最佳答案
@RequestMapping header 描述了请求中必须存在的 header ,以便将其路由到带注释的方法进行处理。在响应对象上调用 setHeader 设置要在响应中发送到客户端的 header
关于java - headers 参数如何用于 RequestMapping 注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31791776/