1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.view.facelets.mock;
21
22 import java.util.Locale;
23
24
25
26
27
28
29 public class MockHttpServletResponse extends org.apache.myfaces.test.mock.MockHttpServletResponse{
30
31 private boolean committed = false;
32 private int status;
33 private String message;
34 private long contentLength = 0;
35 private int bufferSize = 0;
36 private Locale locale = Locale.getDefault();
37
38 public MockHttpServletResponse() {
39 super();
40 setCharacterEncoding("ISO-8859-1");
41 setContentType("text/html");
42 }
43
44 public void sendError(int status, String message){
45 if (this.committed) {
46 throw new IllegalStateException("Response is already committed");
47 }
48 this.status = status;
49 this.message = message;
50 this.committed = true;
51 }
52
53 public void sendError(int status){
54 if (this.committed) {
55 throw new IllegalStateException("Response is already committed");
56 }
57 this.status = status;
58 this.committed = true;
59 }
60
61 public void sendRedirect(String path){
62 if (this.committed) {
63 throw new IllegalStateException("Response is already committed");
64 }
65 this.committed = true;
66 }
67
68 public void setStatus(int sc) {
69 this.status = sc;
70 }
71
72 public void setStatus(int sc, String message) {
73 this.status = sc;
74 this.message = message;
75 }
76
77 public void setContentLength(int contentLength) {
78 this.contentLength = contentLength;
79 }
80
81 public void setBufferSize(int sz) {
82 this.bufferSize = sz;
83 }
84
85 public int getBufferSize() {
86 return this.bufferSize;
87 }
88
89 public void flushBuffer(){
90
91 }
92
93 public void resetBuffer() {
94
95 }
96
97 public boolean isCommitted() {
98 return this.committed;
99 }
100
101 public void reset() {
102
103 }
104
105 }