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

cz.xtf.client.HttpResponseParser Maven / Gradle / Ivy

There is a newer version: 0.35
Show newest version
package cz.xtf.client;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;

public class HttpResponseParser {
    private final int code;
    private final String response;
    private final List
headers; HttpResponseParser(HttpResponse httpResponse) throws IOException { this.code = httpResponse.getStatusLine().getStatusCode(); this.headers = Arrays.asList(httpResponse.getAllHeaders()); this.response = httpResponse.getEntity() == null ? null : EntityUtils.toString(httpResponse.getEntity()).trim(); } public int code() { return code; } public String response() { return response; } public List
headers() { return headers; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy