繁体   English   中英

如何在 post 请求中传递两个参数?

[英]How to pass two parameters in a post request?

我有一个以下列方式发送的发布请求:

final private ObjectMapper mapper;
...
...
Response response =target.request().post(Entity.entity(mapper.writeValueAsString(feedbackFilterDataForDA),
                    APPLICATION_JSON));

请求转到 function 类型:

public Response getData(FeedbackFilterDataForDA f,ArrayList<String> a) {
}

我应该如何更改发布请求以将两个参数都作为输入?

我看到三个选项:

  • Enhance the JSON to include the additional information, eg by wrapping the current JSON in another JSON Object with 2 properties.

  • 将数据发布为application/x-www-form-urlencoded而不是application/json ,其中一个值是 JSON 有效负载。

  • 将数据发布为multipart/form-data而不是application/json ,其中一部分是 JSON 有效负载。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM