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