com.gitee.cliveyuan.tools.http.HttpResp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-tools Show documentation
Show all versions of java-tools Show documentation
Some commonly used methods in java
package com.gitee.cliveyuan.tools.http;
import com.google.common.collect.Maps;
import lombok.ToString;
import java.util.Map;
/**
* Created by clive at 2018/11/27.
*/
@ToString
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;
}
}