001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.chain.web.servlet;
018
019
020 import javax.servlet.ServletOutputStream;
021 import javax.servlet.http.Cookie;
022 import javax.servlet.http.HttpServletResponse;
023 import java.io.IOException;
024 import java.io.PrintWriter;
025 import java.util.Locale;
026
027
028
029 // Mock Object for HttpServletResponse (Version 2.3)
030 public class MockHttpServletResponse implements HttpServletResponse {
031
032
033
034 // ------------------------------------------------------ Instance Variables
035
036
037 private Locale locale = null;
038
039
040 // ---------------------------------------------------------- Public Methods
041
042
043 // --------------------------------------------- HttpServletResponse Methods
044
045
046 public void addCookie(Cookie cookie) {
047 throw new UnsupportedOperationException();
048 }
049
050
051 public void addDateHeader(String name, long value) {
052 throw new UnsupportedOperationException();
053 }
054
055
056 public void addHeader(String name, String value) {
057 throw new UnsupportedOperationException();
058 }
059
060
061 public void addIntHeader(String name, int value) {
062 throw new UnsupportedOperationException();
063 }
064
065
066 public boolean containsHeader(String name) {
067 throw new UnsupportedOperationException();
068 }
069
070
071 public String encodeRedirectUrl(String url) {
072 return (encodeRedirectURL(url));
073 }
074
075
076 public String encodeRedirectURL(String url) {
077 return (url);
078 }
079
080
081 public String encodeUrl(String url) {
082 return (encodeURL(url));
083 }
084
085
086 public String encodeURL(String url) {
087 return (url);
088 }
089
090
091 public void sendError(int status) {
092 throw new UnsupportedOperationException();
093 }
094
095
096 public void sendError(int status, String message) {
097 throw new UnsupportedOperationException();
098 }
099
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 }