Class MockJspWriter
java.lang.Object
java.io.Writer
jakarta.servlet.jsp.JspWriter
org.springframework.mock.web.MockJspWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
public class MockJspWriter
extends jakarta.servlet.jsp.JspWriter
Mock implementation of the
JspWriter class.
Only necessary for testing applications when testing custom JSP tags.- Since:
- 2.5
- Author:
- Juergen Hoeller
-
Field Summary
Fields inherited from class jakarta.servlet.jsp.JspWriter
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER -
Constructor Summary
ConstructorsConstructorDescriptionMockJspWriter(@Nullable jakarta.servlet.http.HttpServletResponse response, @Nullable Writer targetWriter) Create a MockJspWriter for the given response.MockJspWriter(jakarta.servlet.http.HttpServletResponse response) Create a MockJspWriter for the given response, using the response's default Writer.MockJspWriter(Writer targetWriter) Create a MockJspWriter for the given plain Writer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidvoidclose()voidflush()intprotected PrintWriterLazily 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) voidvoidvoidprintln()voidprintln(boolean value) voidprintln(char value) voidprintln(char[] value) voidprintln(double value) voidprintln(float value) voidprintln(int value) voidprintln(long value) voidvoidvoidwrite(char[] value, int offset, int length) Methods inherited from class jakarta.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
-
Constructor Details
-
MockJspWriter
public MockJspWriter(jakarta.servlet.http.HttpServletResponse response) Create a MockJspWriter for the given response, using the response's default Writer.- Parameters:
response- the servlet response to wrap
-
MockJspWriter
Create a MockJspWriter for the given plain Writer.- Parameters:
targetWriter- the target Writer to wrap
-
MockJspWriter
-
-
Method Details
-
getTargetWriter
Lazily initialize the target Writer.- Throws:
IOException
-
clear
- Specified by:
clearin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
clearBuffer
- Specified by:
clearBufferin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
getRemaining
public int getRemaining()- Specified by:
getRemainingin classjakarta.servlet.jsp.JspWriter
-
newLine
- Specified by:
newLinein classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
print
- Specified by:
printin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classjakarta.servlet.jsp.JspWriter- Throws:
IOException
-