001: /*
002: * $Id: StrutsMockBodyContent.java 471756 2006-11-06 15:01:43Z husted $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts2.views.jsp;
022:
023: import java.io.IOException;
024: import java.io.Reader;
025: import java.io.Writer;
026:
027: import javax.servlet.jsp.JspWriter;
028: import javax.servlet.jsp.tagext.BodyContent;
029:
030: /**
031: * StrutsMockBodyContent
032: *
033: */
034: public class StrutsMockBodyContent extends BodyContent {
035:
036: private JspWriter jspWriter;
037: private String body = null;
038:
039: public StrutsMockBodyContent(JspWriter jspWriter) {
040: super (jspWriter);
041: this .jspWriter = jspWriter;
042: }
043:
044: public Reader getReader() {
045: return null;
046: }
047:
048: public int getRemaining() {
049: return jspWriter.getRemaining();
050: }
051:
052: public void setString(String body) {
053: this .body = body;
054: }
055:
056: public String getString() {
057: return body;
058: }
059:
060: public void clear() throws IOException {
061: jspWriter.clear();
062: }
063:
064: public void clearBuffer() throws IOException {
065: jspWriter.clearBuffer();
066: }
067:
068: public void close() throws IOException {
069: jspWriter.close();
070: }
071:
072: public void newLine() throws IOException {
073: jspWriter.newLine();
074: }
075:
076: public void print(double v) throws IOException {
077: jspWriter.print(v);
078: }
079:
080: public void print(int i) throws IOException {
081: jspWriter.print(i);
082: }
083:
084: public void print(long l) throws IOException {
085: jspWriter.print(l);
086: }
087:
088: public void print(float v) throws IOException {
089: jspWriter.print(v);
090: }
091:
092: public void print(boolean b) throws IOException {
093: jspWriter.print(b);
094: }
095:
096: public void print(String s) throws IOException {
097: jspWriter.print(s);
098: }
099:
100: public void print(char c) throws IOException {
101: jspWriter.print(c);
102: }
103:
104: public void print(Object o) throws IOException {
105: jspWriter.print(o);
106: }
107:
108: public void print(char[] chars) throws IOException {
109: jspWriter.print(chars);
110: }
111:
112: public void println() throws IOException {
113: jspWriter.println();
114: }
115:
116: public void println(char c) throws IOException {
117: jspWriter.println(c);
118: }
119:
120: public void println(String s) throws IOException {
121: jspWriter.println(s);
122: }
123:
124: public void println(char[] chars) throws IOException {
125: jspWriter.println(chars);
126: }
127:
128: public void println(boolean b) throws IOException {
129: jspWriter.println(b);
130: }
131:
132: public void println(long l) throws IOException {
133: jspWriter.println(l);
134: }
135:
136: public void println(int i) throws IOException {
137: jspWriter.println(i);
138: }
139:
140: public void println(float v) throws IOException {
141: jspWriter.println(v);
142: }
143:
144: public void println(double v) throws IOException {
145: jspWriter.println(v);
146: }
147:
148: public void println(Object o) throws IOException {
149: jspWriter.println(o);
150: }
151:
152: public void write(char[] chars, int i, int i1) throws IOException {
153: jspWriter.write(chars, i, i1);
154: }
155:
156: public void writeOut(Writer writer) throws IOException {
157: writer.write(body);
158: }
159: }
|