Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | package de.viathinksoft.utils.http; |
2 | |||
3 | import java.io.IOException; |
||
4 | |||
5 | import org.apache.http.HttpEntity; |
||
6 | import org.apache.http.HttpResponse; |
||
7 | import org.apache.http.ParseException; |
||
8 | import org.apache.http.util.EntityUtils; |
||
9 | |||
10 | public class MyHttpResponse { |
||
11 | |||
12 | private String content; |
||
13 | private HttpResponse response; |
||
14 | private int statusCode; |
||
15 | |||
16 | public MyHttpResponse(HttpResponse response) throws ParseException, IOException { |
||
17 | super(); |
||
18 | |||
19 | this.response = response; |
||
20 | |||
21 | HttpEntity ent = response.getEntity(); |
||
22 | if (ent != null) { |
||
23 | this.content = EntityUtils.toString(ent); |
||
24 | ent.consumeContent(); |
||
25 | } |
||
26 | |||
27 | this.statusCode = response.getStatusLine().getStatusCode(); |
||
28 | } |
||
29 | |||
30 | public HttpResponse getResponse() { |
||
31 | return response; |
||
32 | } |
||
33 | |||
34 | public String getContent() { |
||
35 | return content; |
||
36 | } |
||
37 | |||
38 | public int getStatusCode() { |
||
39 | return statusCode; |
||
40 | } |
||
41 | } |