https in java, android

Post

url = new URL("https://112.169.59.24:4443/mmpcs/ua/initSync.do");
//HttpURLConnection conn = (HttpURLConnection) url.openConnection();
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

conn.setDoOutput(true);
conn.setRequestMethod("POST");
String msg = "This is message for post";

OutputStreamWriter wr = new OutputStreamWriter(conn
.getOutputStream());
// this is were we're adding post data to the request
wr.write(msg);
wr.flush();

String str;
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((str = in.readLine()) != null) {
    Log.i("TestApp",str);
}

in.close();
wr.close();

 

 

Get

url = new URL("https://112.169.59.24:4443/mmpcs/ua/initSync.do");
//HttpURLConnection conn = (HttpURLConnection) url.openConnection();
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);

String str;
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((str = in.readLine()) != null) {
    Log.i("TestApp",str);
}

in.close();  

신고

'Computing' 카테고리의 다른 글

CentOS 5.5, mongoDB, node.js  (0) 2011.05.19
iphone opengl camera ar  (0) 2011.05.18
https in java, android  (0) 2010.12.08
x.inf contains DirIDs, which are not supported  (0) 2010.06.10
ffmpeg build  (0) 2010.06.04
VP8 And FFmpeg  (0) 2010.06.03
트랙백 0 댓글 0
prev 1 ··· 15 16 17 18 19 20 21 22 23 ··· 225 next


티스토리 툴바