Package org.springframework.mock.web
Class MockJspWriter
- java.lang.Object
 - java.io.Writer
 - javax.servlet.jsp.JspWriter
 - org.springframework.mock.web.MockJspWriter
 
- All Implemented Interfaces:
 Closeable,Flushable,Appendable,AutoCloseable
public class MockJspWriter extends JspWriter
Mock implementation of theJspWriterclass.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
Constructor Summary
Constructors Constructor Description MockJspWriter(Writer targetWriter)Create a MockJspWriter for the given plain Writer.MockJspWriter(HttpServletResponse response)Create a MockJspWriter for the given response, using the response's default Writer.MockJspWriter(HttpServletResponse response, Writer targetWriter)Create a MockJspWriter for the given response.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclearBuffer()voidclose()voidflush()intgetRemaining()protected PrintWritergetTargetWriter()Lazily initialize the target Writer.voidnewLine()voidprint(boolean value)voidprint(char value)voidprint(char[] value)voidprint(double value)voidprint(float value)voidprint(int value)voidprint(long value)voidprint(Object value)voidprint(String value)voidprintln()voidprintln(boolean value)voidprintln(char value)voidprintln(char[] value)voidprintln(double value)voidprintln(float value)voidprintln(int value)voidprintln(long value)voidprintln(Object value)voidprintln(String value)voidwrite(char[] value, int offset, int length)Methods inherited from class javax.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
Constructor Detail
MockJspWriter
public MockJspWriter(HttpServletResponse response)
Create a MockJspWriter for the given response, using the response's default Writer.- Parameters:
 response- the servlet response to wrap
MockJspWriter
public MockJspWriter(Writer targetWriter)
Create a MockJspWriter for the given plain Writer.- Parameters:
 targetWriter- the target Writer to wrap
MockJspWriter
public MockJspWriter(HttpServletResponse response, Writer targetWriter)
Create a MockJspWriter for the given response.- Parameters:
 response- the servlet response to wraptargetWriter- the target Writer to wrap
Method Detail
getTargetWriter
protected PrintWriter getTargetWriter() throws IOException
Lazily initialize the target Writer.- Throws:
 IOException
clear
public void clear() throws IOException
- Specified by:
 clearin classJspWriter- Throws:
 IOException
clearBuffer
public void clearBuffer() throws IOException
- Specified by:
 clearBufferin classJspWriter- Throws:
 IOException
flush
public void flush() throws IOException
- Specified by:
 flushin interfaceFlushable- Specified by:
 flushin classJspWriter- Throws:
 IOException
close
public void close() throws IOException
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Specified by:
 closein classJspWriter- Throws:
 IOException
getRemaining
public int getRemaining()
- Specified by:
 getRemainingin classJspWriter
newLine
public void newLine() throws IOException
- Specified by:
 newLinein classJspWriter- Throws:
 IOException
write
public void write(char[] value, int offset, int length) throws IOException
- Specified by:
 writein classWriter- Throws:
 IOException
print
public void print(boolean value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(char value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(char[] value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(double value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(float value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(int value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(long value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(Object value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
print
public void print(String value) throws IOException
- Specified by:
 printin classJspWriter- Throws:
 IOException
println
public void println() throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(boolean value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(char value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(char[] value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(double value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(float value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(int value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(long value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(Object value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException
println
public void println(String value) throws IOException
- Specified by:
 printlnin classJspWriter- Throws:
 IOException