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

com.gitee.cliveyuan.tools.http.HttpResp Maven / Gradle / Ivy

There is a newer version: 4.0.6
Show newest version
package com.gitee.cliveyuan.tools.http;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by clive at 2018/11/27.
 */
public class HttpResp {

    private int statusCode = 200;
    private String content;
    private Map cookies = Maps.newHashMap();
    private Map headers = Maps.newHashMap();

    public HttpResp() {
    }

    public HttpResp(String content) {
        this.content = content;
    }

    public HttpResp(String content, Map cookies, Map headers) {
        this.content = content;
        this.cookies = cookies;
        this.headers = headers;
    }

    public static HttpResp create() {
        return new HttpResp();
    }

    public static HttpResp create(String content) {
        return new HttpResp(content);
    }


    public static HttpResp create(String content, Map cookies, Map headers) {
        return new HttpResp(content, cookies, headers);
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Map getCookies() {
        return cookies;
    }

    public void setCookies(Map cookies) {
        this.cookies = cookies;
    }

    public void addCookie(String key, String value) {
        this.cookies.put(key, value);
    }

    public Map getHeaders() {
        return headers;
    }

    public void setHeaders(Map headers) {
        this.headers = headers;
    }

    public void addHeader(String key, String value) {
        this.headers.put(key, value);
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy