[완료]Java에서 외부에 https 요청에 대해서 아시는 분계신가요 ㅜㅜ
안녕하세요.
안드로이드 push서비스를 혼자 테스트해보려고
jsp파일을 만들어서 요청을 날리게 하려고 했습니다.
그런데
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching android.apis.google.com found.
이런 익셉션이 발생하네요 ㅜㅜ
왜 그런걸까요 ㅜㅜ 아래는 해당소스입니다.
StringBuffer postDataBuilder = new StringBuffer();
if(regId == null){
return ;
}
postDataBuilder.append("registration_id="+regId); //등록ID
postDataBuilder.append("&collapse_key=1");
postDataBuilder.append("&delay_while_idle=1");
postDataBuilder.append("&data.msg="+URLEncoder.encode(msg, "UTF-8")); //태울 메시지
byte[] postData = postDataBuilder.toString().getBytes("UTF8");
URL url = new URL("https://android.apis.google.com/c2dm/send");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", Integer.toString(postData.length));
conn.setRequestProperty("Authorization", "GoogleLogin auth=" + authToken);
OutputStream out = conn.getOutputStream(); // 이부분에서 익셉션이 발생합니다...
out.write(postData);
out.close();
conn.getInputStream();
http://groups.google.com/grou
http://groups.google.com/group/android-developers/browse_thread/thread/d9abbe2f262e58d5?pli=1
재벌 2세가 재벌이 될 확률과
금메달리스트 2세가 금메달을 딸 확률이 비슷해지도록
자유오픈소스 대안화폐를 씁시다.
아이디의 아이디어 무한도전
http://blog.aaidee.com
귀태닷컴
http://www.gwitae.com
와웅 해결됬어요~!
감사합니다 ㅜㅜ
댓글 달기