01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.internal.test;
16:
17: import java.io.ByteArrayOutputStream;
18: import java.io.IOException;
19: import java.io.OutputStream;
20: import java.io.PrintWriter;
21:
22: import org.apache.tapestry.services.Response;
23:
24: public class TestableResponseImpl implements Response {
25:
26: private void nyi(String methodName) {
27: throw new RuntimeException(String.format(
28: "TestableResponse: Method %s() not yet implemented.",
29: methodName));
30: }
31:
32: public OutputStream getOutputStream(String contentType)
33: throws IOException {
34: nyi("getOutputStream");
35:
36: return null;
37: }
38:
39: public PrintWriter getPrintWriter(String contentType)
40: throws IOException {
41: // Welll, the output isn't accessible, but I guess we see that it could be generated from
42: // the DOM.
43: return new PrintWriter(new ByteArrayOutputStream());
44: }
45:
46: public void sendError(int sc, String message) throws IOException {
47: nyi("sendError");
48: }
49:
50: public void sendRedirect(String URL) throws IOException {
51: nyi("sendRedirect");
52: }
53:
54: public void setContentLength(int length) {
55: nyi("setContentLength");
56: }
57:
58: public void setDateHeader(String name, long date) {
59: nyi("setDateHeader");
60: }
61:
62: public void setHeader(String name, String value) {
63: nyi("setHeader");
64: }
65:
66: public void setIntHeader(String name, int value) {
67: nyi("setIntHeader");
68: }
69:
70: public String encodeRedirectURL(String URL) {
71: return URL;
72: }
73:
74: public String encodeURL(String URL) {
75: return URL;
76: }
77:
78: }
|