com.taobao.drc.clusterclient.httpclient.HttpResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consumer-core Show documentation
Show all versions of consumer-core Show documentation
The java consumer core component for Data Transmission Service
package com.taobao.drc.clusterclient.httpclient;
import org.apache.http.impl.client.BasicResponseHandler;
import java.io.IOException;
public class HttpResponse {
private int code;
private String body;
public HttpResponse(org.apache.http.HttpResponse response)
throws IllegalStateException, IOException {
code = response.getStatusLine().getStatusCode();
try {
body = new BasicResponseHandler().handleResponse(response);
} catch (Exception e) {
body = e.getMessage();
}
}
public HttpResponse(int code, String body) {
this.code = code;
this.body = body;
}
public void setCode(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public void setString(final String body) {
this.body = body;
}
public final String getString() {
return body;
}
@Override
public String toString() {
return "{code=" + code + ", body=" + body + "}";
}
}