HttpServletResponse 内容输出

来源:百度知道 编辑:UC知道 时间:2024/06/02 05:59:11
我想取得HttpServletResponse中OutputStream()里的全部内容(例如编码信息,头信心之类的东西),然后以string的形式保存起来,有什么好方法吗?
我补充一下,不是一个变量一个变量的输出,是有什么办法把“所有”的信息保存起来。 OutputStream().toString() 输出的是OutputStream()对象的名称。问题已经解决了,用程序好像无法实现,我用了一个软件截取了response的全部头信息。谢谢大家的回答。分数就给第一个回答的人吧。

response.getContentType();
a String specifying the content type,
for example, text/html; charset=UTF-8, or null

response.getCharacterEncoding();
a String specifying the name of the character encoding,
for example, UTF-8

我没有运行,但是你可以打印一下
OutputStream().toString() 看看出来的字符串你能不能接受