기술참고자료/JAVA | 2011. 3. 21. 14:14
/**
* Http경로를 인자로 넘겨 서버의 출력결과를 스트링으로 리턴받는다.
*
* @param path http경로
* @return 서버결과
*/
public static String getHttpResult(String path) {
String strXML = null;
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(path);
try {
int returnCode = client.executeMethod(method);
if (returnCode == 200) {
strXML = method.getResponseBodyAsString();
}
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
method.releaseConnection();
}
return strXML;
}
[JAVA] XML 직렬화도구 - Simple Framework (1) | 2011.06.21 |
---|---|
[JAVA] Hashmap & List 정렬기법 (0) | 2011.05.02 |
List Sort Sample Using Comparator<T> Interface (0) | 2011.03.17 |
DOM Parser vs SAX Parser (0) | 2011.03.17 |
How to send an XML document to a remote web server using HTTP POST (0) | 2011.03.17 |
Recent Comments