
이렇게 하려면 구조화된 문서에서 구조와 데이터를 분리하여 볼 수 있어야 하는데 다음 사이트에서 JSON 데이터를 이와 같이 분리하여 볼 수 있다.
www.tktools.net/j2t.html
In this blog, there are many things that I did and got or get to know, while I am developing applications. I write the articles to remember in mind and I hope they will be helpful for the visitors who read them.



public InputStream GetHTTPInputStream(URL url) throws Exception
{
int redirectedCount = 0;
while( redirectedCount <= 1 ) // Redirection 1번 허용
{
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setConnectTimeout(10000); //< 연결 제한시간(단위 : msec, 0은 무한)
httpConn.setReadTimeout(0); //< 읽기 제한시간(단위 : msec, 0은 무한)
httpConn.setUseCaches(false); //< 캐시 사용 여부 설정(기본 설정: true)
// URL을 요청하는 방법 설정 (GET|POST|HEAD|OPTIONS|PUT|DELETE|TRACE, 기본 설정: GET)
httpConn.setRequestMethod("GET");
int resCode = httpConn.getResponseCode();
if( resCode == HttpsURLConnection.HTTP_OK )
{
return httpConn.getInputStream();
}
// Redirection 발생하는 경우
else if( resCode == HttpsURLConnection.HTTP_MOVED_TEMP
|| resCode == HttpsURLConnection.HTTP_MOVED_PERM )
{
// Redirected URL 받아오기
String redirectedUrl = httpConn.getHeaderField("Location");
url = new URL(redirectedUrl);
}
// 이외의 오류는 Exception 처리
else
throw new MalformedURLException("can not connect to the url [" + url.toString() + "] Code: " + resCode);
++redirectedCount;
}
}
