blob: 43c0b8697c37ba50231d7e3d572284284d94b8f5 (
plain)
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
|
package org.simpleframework.http.core;
import static org.simpleframework.http.Protocol.CLOSE;
import static org.simpleframework.http.Protocol.CONNECTION;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.channels.WritableByteChannel;
import java.util.Map;
import org.simpleframework.http.Response;
import org.simpleframework.http.core.ResponseMessage;
public class MockResponse extends ResponseMessage implements Response {
private boolean committed;
public MockResponse() {
super();
}
public OutputStream getOutputStream() {
return System.out;
}
public boolean isKeepAlive() {
String value = getValue(CONNECTION);
if(value != null) {
return value.equalsIgnoreCase(CLOSE);
}
return true;
}
public boolean isCommitted() {
return committed;
}
public void commit() {
committed = true;
}
public void reset() {
return;
}
public void close() {
return;
}
public Object getAttribute(String name) {
return null;
}
public Map getAttributes() {
return null;
}
public OutputStream getOutputStream(int size) throws IOException {
return null;
}
public PrintStream getPrintStream() throws IOException {
return null;
}
public PrintStream getPrintStream(int size) throws IOException {
return null;
}
public void setContentLength(long length) {
setValue("Content-Length", String.valueOf(length));
}
public WritableByteChannel getByteChannel() throws IOException {
return null;
}
public WritableByteChannel getByteChannel(int size) throws IOException {
return null;
}
public boolean isEmpty() {
return false;
}
public long getResponseTime() {
return 0;
}
public void setContentType(String type) {
setValue("Content-Type", type);
}
}
|