Package org.springframework.mock.web
Class MockBodyContent
java.lang.Object
java.io.Writer
jakarta.servlet.jsp.JspWriter
jakarta.servlet.jsp.tagext.BodyContent
org.springframework.mock.web.MockBodyContent
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Mock implementation of the
BodyContent 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
ConstructorsConstructorDescriptionMockBodyContent(String content, HttpServletResponse response) Create a MockBodyContent for the given response.MockBodyContent(String content, HttpServletResponse response, Writer targetWriter) Create a MockBodyContent for the given response.MockBodyContent(String content, Writer targetWriter) Create a MockBodyContent for the given response. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidvoidclose()intvoidnewLine()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) voidMethods inherited from class jakarta.servlet.jsp.tagext.BodyContent
clearBody, flush, getEnclosingWriterMethods inherited from class jakarta.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
-
Constructor Details
-
MockBodyContent
Create a MockBodyContent for the given response.- Parameters:
content- the body content to exposeresponse- the servlet response to wrap
-
MockBodyContent
Create a MockBodyContent for the given response.- Parameters:
content- the body content to exposetargetWriter- the target Writer to wrap
-
MockBodyContent
public MockBodyContent(String content, @Nullable HttpServletResponse response, @Nullable Writer targetWriter) Create a MockBodyContent for the given response.- Parameters:
content- the body content to exposeresponse- the servlet response to wraptargetWriter- the target Writer to wrap
-
-
Method Details
-
getReader
- Specified by:
getReaderin classBodyContent
-
getString
- Specified by:
getStringin classBodyContent
-
writeOut
- Specified by:
writeOutin classBodyContent- Throws:
IOException
-
clear
- Specified by:
clearin classJspWriter- Throws:
IOException
-
clearBuffer
- Specified by:
clearBufferin classJspWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classJspWriter- Throws:
IOException
-
getRemaining
public int getRemaining()- Specified by:
getRemainingin classJspWriter
-
newLine
- Specified by:
newLinein classJspWriter- Throws:
IOException
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
print
- Specified by:
printin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-
println
- Specified by:
printlnin classJspWriter- Throws:
IOException
-