All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taobao.drc.clusterclient.httpclient.HttpResponse Maven / Gradle / Ivy

There is a newer version: 5.0.0.1.beta
Show newest version
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 + "}";
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy