jiangping
2024-05-22 a7fb50c91e4932aa175be266fbdd42b2a70eba66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package cn.emay.sdk.util.http.response.impl.string;
 
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
 
import cn.emay.sdk.util.http.common.EmayHttpResultCode;
 
/**
 * 【自定义】String类型Http响应
 * 
 * @author Frank
 *
 */
public class EmayHttpResponseString {
 
    private EmayHttpResultCode resultCode; //HttpClient 结果代码
    private int httpCode; //Http链接Code
    private Map<String, String> headers;//Http响应头
    private List<String> cookies;//http响应Cookies
    private String resultString;//http响应数据
    private String charSet;//http响应编码
 
    /**
     * 
     * @param charSet http响应编码
     * @param resultCode HttpClient结果代码
     * @param httpCode Http链接Code
     * @param headers Http响应头
     * @param cookies http响应Cookies
     * @param resultString http响应数据
     */
    public EmayHttpResponseString(String charSet,EmayHttpResultCode resultCode, int httpCode, Map<String, String> headers, List<String> cookies, String resultString) {
        this.resultCode = resultCode;
        this.httpCode = httpCode;
        this.headers = headers;
        this.cookies = cookies;
        this.resultString = resultString;
        this.charSet = charSet;
    }
 
    public EmayHttpResultCode getResultCode() {
        return resultCode;
    }
 
    public void setResultCode(EmayHttpResultCode resultCode) {
        this.resultCode = resultCode;
    }
 
    public int getHttpCode() {
        return httpCode;
    }
 
    public void setHttpCode(int httpCode) {
        this.httpCode = httpCode;
    }
 
    public Map<String, String> getHeaders() {
        return headers;
    }
 
    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }
 
    public List<String> getCookies() {
        return cookies;
    }
 
    public void setCookies(List<String> cookies) {
        this.cookies = cookies;
    }
 
    public String getResultString() {
        return resultString;
    }
 
    public void setResultString(String resultString) {
        this.resultString = resultString;
    }
 
    public String toString(){
        StringBuffer buffer = new StringBuffer();
        for(Field filed : this.getClass().getDeclaredFields()){
            Object value = null;
            try {
                value = filed.get(this);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
            buffer.append("[ ").append(filed.getName()).append(" : ").append(value).append(" ]");
        }
        return buffer.toString();
        
    }
 
    public String getCharSet() {
        return charSet;
    }
 
    public void setCharSet(String charSet) {
        this.charSet = charSet;
    }
    
}