类 MockBodyContent
- java.lang.Object
- java.io.Writer
- javax.servlet.jsp.JspWriter
- javax.servlet.jsp.tagext.BodyContent
- org.springframework.mock.web.MockBodyContent
- 所有已实现的接口:
Closeable
,Flushable
,Appendable
,AutoCloseable
public class MockBodyContent extends BodyContent
Mock implementation of theBodyContent
class.Used for testing the web framework; only necessary for testing applications when testing custom JSP tags.
- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller
字段概要
从类继承的字段 javax.servlet.jsp.JspWriter
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER
构造器概要
构造器 构造器 说明 MockBodyContent(String content, Writer targetWriter)
Create a MockBodyContent for the given response.MockBodyContent(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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
clear()
void
clearBuffer()
void
close()
Reader
getReader()
int
getRemaining()
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(Object value)
void
print(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(Object value)
void
println(String value)
void
write(char[] value, int offset, int length)
void
writeOut(Writer writer)
从类继承的方法 javax.servlet.jsp.tagext.BodyContent
clearBody, flush, getEnclosingWriter
从类继承的方法 javax.servlet.jsp.JspWriter
getBufferSize, isAutoFlush
构造器详细资料
MockBodyContent
public MockBodyContent(String content, HttpServletResponse response)
Create a MockBodyContent for the given response.- 参数:
content
- the body content to exposeresponse
- the servlet response to wrap
MockBodyContent
public MockBodyContent(String content, Writer targetWriter)
Create a MockBodyContent for the given response.- 参数:
content
- the body content to exposetargetWriter
- the target Writer to wrap
MockBodyContent
public MockBodyContent(String content, HttpServletResponse response, Writer targetWriter)
Create a MockBodyContent for the given response.- 参数:
content
- the body content to exposeresponse
- the servlet response to wraptargetWriter
- the target Writer to wrap
方法详细资料
getReader
public Reader getReader()
- 指定者:
getReader
在类中BodyContent
getString
public String getString()
- 指定者:
getString
在类中BodyContent
writeOut
public void writeOut(Writer writer) throws IOException
- 指定者:
writeOut
在类中BodyContent
- 抛出:
IOException
clear
public void clear() throws IOException
- 指定者:
clear
在类中JspWriter
- 抛出:
IOException
clearBuffer
public void clearBuffer() throws IOException
- 指定者:
clearBuffer
在类中JspWriter
- 抛出:
IOException
close
public void close() throws IOException
- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中Closeable
- 指定者:
close
在类中JspWriter
- 抛出:
IOException
getRemaining
public int getRemaining()
- 指定者:
getRemaining
在类中JspWriter
newLine
public void newLine() throws IOException
- 指定者:
newLine
在类中JspWriter
- 抛出:
IOException
write
public void write(char[] value, int offset, int length) throws IOException
- 指定者:
write
在类中Writer
- 抛出:
IOException
print
public void print(boolean value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(char value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(char[] value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(double value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(float value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(int value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(long value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(Object value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
print
public void print(String value) throws IOException
- 指定者:
print
在类中JspWriter
- 抛出:
IOException
println
public void println() throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(boolean value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(char value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(char[] value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(double value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(float value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(int value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(long value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(Object value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException
println
public void println(String value) throws IOException
- 指定者:
println
在类中JspWriter
- 抛出:
IOException