如何在play 2.1 Java中为WS.post()设置参数

我试图用play.api.libs.ws.WS执行一个职位,但我无法弄清楚
如何设置参数,我的代码
Promise<Response> promise = WS.url(Play.application().configuration()
                .getString("sms.service.url")).post();

.post take(T body,play.api.http.Writeable wrt,play.api.http.ContentTypeOf ct)
但我不明白我应该如何通过params那里.
文档仅说明:

Promise<WS.Response> result = WS.url("http://localhost:9001").post("content");

如何设置内容? param1 = foo和param2 = bar?

解决方法

尝试构建这样的请求:
WS.url("http://localhost:9001")
    .setQueryParameter("param1","foo")
    .setQueryParameter("param2","bar")
    .post("content");

方法url(java.lang.String url)返回一个WS.WSRequestHolder引用,可用于使用链接setQueryParameter调用修改原始请求.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...