Hi,
I'm migrating from async-http-client to jetty 9 client, I use extensibly Async communication, the problem I'm having is that no params are passed on POST communication:
Example:
HttpClient httpclient = new HttpClient(); httpclient.start();
httpClient.POST(URIOFRESOURCE).param("param1", JSONSTRING).send(new BufferingResponseListener() { @Override public void onComplete(Result res) { result = getContentAsString("UTF-8"); } });
the thing is param1 won't get to the server (Server is also Jetty 9, and works fine if I use async-http-client or using something like this:
public static String ExecSyncPOSTRESTWebService(String resource, String data) { try {
URL url = "" URL(REST + resource); URLConnection conn = url.openConnection(); conn.setDoOutput(true); BufferedReader rd; String buffer; try (OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream(), "UTF-8")) { wr.write(data); wr.flush(); rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); String line; buffer = ""; while ((line = rd.readLine()) != null) { buffer = buffer + line; } } rd.close();
return buffer;
} catch (Exception ex) { Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, ex.toString()); return ""; }
}
where data is param1=JSON
)
any idea what am I doing wrong on this basic setup???
|