public boolean isValidSession(String url) {
boolean result = false;
try {
URL servletUrl = new URL(url);
HttpURLConnection uc = (HttpURLConnection) servletUrl
.openConnection();
uc.setRequestMethod("GET");
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setUseCaches(false);
uc.connect();
if (uc.getResponseCode() == HttpURLConnection.HTTP_OK)
result = true;
uc.disconnect();
} catch (Exception e) {
result = false;
}
return result;
}
'언어 > JAVA' 카테고리의 다른 글
[Calendar] 날짜체크 (0) | 2016.06.23 |
---|---|
[JAVA]Request to hashMap (0) | 2016.05.12 |
[Editor] 태그제거 (정규식) (0) | 2016.02.17 |
리플렉션 (0) | 2015.04.01 |
Calendar , date (0) | 2015.03.17 |