Spring Framework

org.springframework.mock.web
Class MockBodyContent

java.lang.Object
  extended by java.io.Writer
      extended by javax.servlet.jsp.JspWriter
          extended by javax.servlet.jsp.tagext.BodyContent
              extended by org.springframework.mock.web.MockBodyContent
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class MockBodyContent
extends javax.servlet.jsp.tagext.BodyContent

Mock implementation of the BodyContent class.

Used for testing the web framework; only necessary for testing applications when testing custom JSP tags.

Since:
2.5
Author:
Juergen Hoeller

Field Summary
 
Fields inherited from class javax.servlet.jsp.JspWriter
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
MockBodyContent(java.lang.String content, javax.servlet.http.HttpServletResponse response)
          Create a MockBodyContent for the given response.
MockBodyContent(java.lang.String content, javax.servlet.http.HttpServletResponse response, java.io.Writer targetWriter)
          Create a MockBodyContent for the given response.
MockBodyContent(java.lang.String content, java.io.Writer targetWriter)
          Create a MockBodyContent for the given response.
 
Method Summary
 void clear()
           
 void clearBuffer()
           
 void close()
           
 java.io.Reader getReader()
           
 int getRemaining()
           
 java.lang.String getString()
           
 void newLine()
           
 void print(boolean value)
           
 void print(char value)
           
 void print(char[] value)
           
 void print(double value)
           
 void print(float value)
           
 void print(int value)
           
 void print(long value)
           
 void print(java.lang.Object value)
           
 void print(java.lang.String value)
           
 void println()
           
 void println(boolean value)
           
 void println(char value)
           
 void println(char[] value)
           
 void println(double value)
           
 void println(float value)
           
 void println(int value)
           
 void println(long value)
           
 void println(java.lang.Object value)
           
 void println(java.lang.String value)
           
 void write(char[] value, int offset, int length)
           
 void writeOut(java.io.Writer writer)
           
 
Methods inherited from class javax.servlet.jsp.tagext.BodyContent
clearBody, flush, getEnclosingWriter
 
Methods inherited from class javax.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockBodyContent

public MockBodyContent(java.lang.String content,
                       javax.servlet.http.HttpServletResponse response)
Create a MockBodyContent for the given response.

Parameters:
content - the body content to expose
response - the servlet response to wrap

MockBodyContent

public MockBodyContent(java.lang.String content,
                       java.io.Writer targetWriter)
Create a MockBodyContent for the given response.

Parameters:
content - the body content to expose
targetWriter - the target Writer to wrap

MockBodyContent

public MockBodyContent(java.lang.String content,
                       javax.servlet.http.HttpServletResponse response,
                       java.io.Writer targetWriter)
Create a MockBodyContent for the given response.

Parameters:
content - the body content to expose
response - the servlet response to wrap
targetWriter - the target Writer to wrap
Method Detail

getReader

public java.io.Reader getReader()
Specified by:
getReader in class javax.servlet.jsp.tagext.BodyContent

getString

public java.lang.String getString()
Specified by:
getString in class javax.servlet.jsp.tagext.BodyContent

writeOut

public void writeOut(java.io.Writer writer)
              throws java.io.IOException
Specified by:
writeOut in class javax.servlet.jsp.tagext.BodyContent
Throws:
java.io.IOException

clear

public void clear()
           throws java.io.IOException
Specified by:
clear in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

clearBuffer

public void clearBuffer()
                 throws java.io.IOException
Specified by:
clearBuffer in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

getRemaining

public int getRemaining()
Specified by:
getRemaining in class javax.servlet.jsp.JspWriter

newLine

public void newLine()
             throws java.io.IOException
Specified by:
newLine in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

write

public void write(char[] value,
                  int offset,
                  int length)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

print

public void print(boolean value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(char value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(char[] value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(double value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(float value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(int value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(long value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(java.lang.Object value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

print

public void print(java.lang.String value)
           throws java.io.IOException
Specified by:
print in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println()
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(boolean value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(char value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(char[] value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(double value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(float value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(int value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(long value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(java.lang.Object value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

println

public void println(java.lang.String value)
             throws java.io.IOException
Specified by:
println in class javax.servlet.jsp.JspWriter
Throws:
java.io.IOException

Spring Framework