1   /*
2    * Copyright 1999-2004 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.chain.web.servlet;
17  
18  
19  import javax.servlet.ServletOutputStream;
20  import javax.servlet.http.Cookie;
21  import javax.servlet.http.HttpServletResponse;
22  import java.io.IOException;
23  import java.io.PrintWriter;
24  import java.util.Locale;
25  
26  
27  
28  // Mock Object for HttpServletResponse (Version 2.3)
29  public class MockHttpServletResponse implements HttpServletResponse {
30  
31  
32  
33      // ------------------------------------------------------ Instance Variables
34  
35  
36      private Locale locale = null;
37  
38  
39      // ---------------------------------------------------------- Public Methods
40  
41  
42      // --------------------------------------------- HttpServletResponse Methods
43  
44  
45      public void addCookie(Cookie cookie) {
46          throw new UnsupportedOperationException();
47      }
48  
49  
50      public void addDateHeader(String name, long value) {
51          throw new UnsupportedOperationException();
52      }
53  
54  
55      public void addHeader(String name, String value) {
56          throw new UnsupportedOperationException();
57      }
58  
59  
60      public void addIntHeader(String name, int value) {
61          throw new UnsupportedOperationException();
62      }
63  
64  
65      public boolean containsHeader(String name) {
66          throw new UnsupportedOperationException();
67      }
68  
69  
70      public String encodeRedirectUrl(String url) {
71          return (encodeRedirectURL(url));
72      }
73  
74  
75      public String encodeRedirectURL(String url) {
76          return (url);
77      }
78  
79  
80      public String encodeUrl(String url) {
81          return (encodeURL(url));
82      }
83  
84  
85      public String encodeURL(String url) {
86          return (url);
87      }
88  
89  
90      public void sendError(int status) {
91          throw new UnsupportedOperationException();
92      }
93  
94  
95      public void sendError(int status, String message) {
96          throw new UnsupportedOperationException();
97      }
98  
99  
100     public void sendRedirect(String location) {
101         throw new UnsupportedOperationException();
102     }
103 
104 
105     public void setDateHeader(String name, long value) {
106         throw new UnsupportedOperationException();
107     }
108 
109 
110     public void setHeader(String name, String value) {
111         throw new UnsupportedOperationException();
112     }
113 
114 
115     public void setIntHeader(String name, int value) {
116         throw new UnsupportedOperationException();
117     }
118 
119 
120     public void setStatus(int status) {
121         throw new UnsupportedOperationException();
122     }
123 
124 
125     public void setStatus(int status, String message) {
126         throw new UnsupportedOperationException();
127     }
128 
129 
130     // ------------------------------------------------- ServletResponse Methods
131 
132 
133     public void flushBuffer() {
134         throw new UnsupportedOperationException();
135     }
136 
137 
138     public int getBufferSize() {
139         throw new UnsupportedOperationException();
140     }
141 
142 
143     public String getCharacterEncoding() {
144         throw new UnsupportedOperationException();
145     }
146 
147 
148     public String getContentType() {
149     throw new UnsupportedOperationException();
150     }
151 
152 
153     public Locale getLocale() {
154         return (this.locale);
155     }
156 
157 
158     public ServletOutputStream getOutputStream() throws IOException {
159         throw new UnsupportedOperationException();
160     }
161 
162 
163     public PrintWriter getWriter() throws IOException {
164         throw new UnsupportedOperationException();
165     }
166 
167 
168     public boolean isCommitted() {
169         throw new UnsupportedOperationException();
170     }
171 
172 
173     public void reset() {
174         throw new UnsupportedOperationException();
175     }
176 
177 
178     public void resetBuffer() {
179         throw new UnsupportedOperationException();
180     }
181 
182 
183     public void setBufferSize(int size) {
184         throw new UnsupportedOperationException();
185     }
186 
187 
188     public void setCharacterEncoding(String encoding) {
189     throw new UnsupportedOperationException();
190     }
191 
192 
193     public void setContentLength(int length) {
194         throw new UnsupportedOperationException();
195     }
196 
197 
198     public void setContentType(String type) {
199         throw new UnsupportedOperationException();
200     }
201 
202 
203     public void setLocale(Locale locale) {
204     this.locale = locale;
205     }
206 
207 
208 }