this simple post method didn't send anything to server(servlet). I can get, but i can't post!
@Override
protected String doInBackground(String... params) {
try {
URL url = new URL("http://ipaddr:8080/work/wh");
HttpURLConnection client = (HttpURLConnection) url.openConnection();
client.setRequestMethod("POST");
client.setDoOutput(true);
client.setChunkedStreamingMode(0);
client.connect();
OutputStream outputStream = client.getOutputStream();
PrintWriter pw = new PrintWriter(outputStream);
pw.println(System.currentTimeMillis());
pw.println(System.currentTimeMillis());
pw.println(new Float(5.6));
pw.println(new Integer(3));
pw.println(new Integer(2));
pw.println(new Integer(32));
pw.println(new Integer(2));
pw.close();
outputStream.close();
}catch(Exception e){
Log.e("text", "ux " + e.getMessage());
}
return null;
}
at server side if i tried to read any line new Scanner(request.getInputStream()).nextLine();
I get
NoSuchElementException: No line found
what do you think might be the problem?