i try to build an https client for android and i need do get some request of an Servlet
but when i use the getInputStream method the applicaion hangs.
There is no error only hanging when i call the method.
String url = "https://.../Servlet";
try {
mPushLiteConnection = (HttpsURLConnection) new URL(url).openConnection();
mPushLiteConnection.setDoOutput(true);
mPushLiteConnection.setDoInput(true);
mPushLiteConnection.setRequestMethod("POST");
mPushLiteConnection.connect();
subscribe();
InputStream in = (InputStream)mPushLiteConnection.getInputStream();
unsubscribe();
mPushLiteConnection.disconnect();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this is only to check the call, but it didtn work.
Any idea why it hangs and tell me nothing?
the subscribe method works, when i comment out the line with the inputstream, the server show me all is correct.
I can try the same with the Firefox and it works and i can see the request.
i also put the keystore into the TrustManager.
sorry for my english i hope i explain it ennougth.
THX
I think i know the reason!
the method getInputStream() needs (why ever) the contentLength!
In the servlet i want to connect to is no contentLength couse it is an push chunked servlet… it sends all the time pieces of XML without length.
So.. HttpsURLConnection are not usefull for chunked!
Now i try the same connection with httpClient
i hope it works for it… if not: i jump behind the bus 😉