2020년 1월 14일 화요일

HttpStatusCode 체크

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
 
 
HttpClient client = HttpClientBuilder.create().build();
HttpResponse response = client.execute(new HttpGet(URL));
int statusCode = response.getStatusLine().getStatusCode();
logger.debug("StatusCode: {}", statusCode);

댓글 없음:

댓글 쓰기