Package org.springframework.mock.web
Class MockJspWriter
java.lang.Object
java.io.Writer
jakarta.servlet.jsp.JspWriter
org.springframework.mock.web.MockJspWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
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
ConstructorDescriptionMockJspWriter
(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.MockJspWriter
(Writer targetWriter) Create a MockJspWriter for the given plain Writer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
void
close()
void
flush()
int
protected PrintWriter
Lazily initialize the target Writer.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
void
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
void
void
write
(char[] value, int offset, int length) Methods inherited from class jakarta.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
-
Constructor Details
-
MockJspWriter
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
Create a MockJspWriter for the given response.- Parameters:
response
- the servlet response to wraptargetWriter
- the target Writer to wrap
-
-
Method Details
-
getTargetWriter
Lazily initialize the target Writer.- Throws:
IOException
-
clear
- Specified by:
clear
in classJspWriter
- Throws:
IOException
-
clearBuffer
- Specified by:
clearBuffer
in classJspWriter
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classJspWriter
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classJspWriter
- Throws:
IOException
-
getRemaining
public int getRemaining()- Specified by:
getRemaining
in classJspWriter
-
newLine
- Specified by:
newLine
in classJspWriter
- Throws:
IOException
-
write
- Specified by:
write
in classWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
print
- Specified by:
print
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-
println
- Specified by:
println
in classJspWriter
- Throws:
IOException
-