我编写了一个带有 4 个参数的 Spring REST 服务。其中一个参数“登录”是已知的,其余 3 个是动态的。有什么方法可以让我作为参数登录并在 MultiValue Map 中获取其余参数?我尝试了以下方法并在变量“login”中获得了值,并且它也包含在多值映射中。我希望登录不包含在多值映射中
public void getDataForDownload(@RequestParam("login") String login, @RequestParam MultiValueMap<String, Object> parameters, HttpServletResponse response) throws Exception
{
response.setContentType("text/csv");
String headerKey = "Content-Disposition";
String headerValue = String.format("attachment; filename=\"%s\"",
DOWNLOAD_FILE_NAME);
response.setHeader(headerKey, headerValue);
Map<String, Object> params = getParamsAsMap(parameters);
m_download.writeDataToWriter(response.getWriter(), params);
response.getWriter().close();
}
示例网址:localost:8080/download?login=xyz@xyx.com¶m1=1¶m2=2¶m3=3
当我打印变量时
login:xyz@xyx.com
map:
login = xyz@xyx.com
param1 = 1
param2 = 2
param3 = 3
请让我知道我正在寻找的东西是否可以完成