我试图在我的应用程序中保存一些数据时遇到问题。我的代码的相关部分是:playframework:WSRequestHolder持有人= WS.url(url) - >错误:没有找到合适的方法为url(字符串)
String url = "http://xxx.xxx.x.xxx:xxxx/en";
HashMap<Integer,String> id_name_env = new HashMap<Integer,String>();
WSRequestHolder holder = WS.url(url); //here is the problem ...
holder.setHeader("Cookie", "sessionid="+ session("sessionid"));
holder.setContentType("application/json");
ArrayList<Integer> envList = new ArrayList<Integer>();
WSResponse response = holder.get().get(20000);
JsonNode content = response.asJson();
List<String> listaIduri = content.findValuesAsText("id");
for(String id : listaIduri){
id_name_env.put(Integer.parseInt(id), id);
}
,我得到的错误是:
error: no suitable method found for url(String)
在Eclipse中,它提供了不同的消息:
The method url(WSRequestHolderMagnet) in the type WS is not applicable for the arguments (String)
我在做什么错? url
有问题吗? Eclipse建议将url
变量类型更改为WSRequestHolderMagnet
。