Modifying the Response in Weblogic8.1
来源:互联网 发布:黑马java基础班视频 编辑:程序博客网 时间:2024/05/22 10:55
Modifying the Response inWeblogic8.1
看过一些中文资料在介绍filter的修改response的做法,但在tomcat与weblogic环境使用时总有些麻烦。原因有二:
1.他们在文章中照搬了《More Servlets andJavaServer Pages》一书中的例子代码,人家是用英文嘛,所以就没考虑中文的问题。
修改response的响应长度的代码是 response.setContentLength( responseString.length() );当响应中存在中文的时候就出麻烦了,responseString.length()返回的并不是想要得到的响应的字节长度,所以要使用responseString.getBytes().length确保得到的是修改后的响应正确长度。
2.经过第一条的修改后是能够在tomcat下可以运行了,但在weblogic8.1中就不可以了。这是因为weblogic的实现方式有点特别,weblogic在使用输出时是使用的OutputStream的writer的方法,而不是《More Servlets andJavaServer Pages》一书中所期待使用PrintWriter(tomcat正是这么实现的)。那么在weblogic中实现就有点麻烦了,首先要自己实现一个ServletOutputStream,自己做个字节缓冲区。覆写response的getOutputStream的方法让它返回自己实现的ServletOutputStream对象,而且在从字节缓冲区取出响应字符串时还要指定编码方式,否则会出现乱码哦。- Modifying the Response in Weblogic8.1
- Modifying the Navigation Stack
- Effects with the Pixel Bender Toolkit – Part 6: Modifying Pixel Bender parameters in Flash
- Modifying the VIP Address or VIP Hostname in Oracle RAC Node
- No response of the eclipse in Ubuntu
- Modifying
- the weblogic8.1 the portable Bean weblogic9.2 already exists: "weblogic.j2ee.descriptor.ServletMappi
- Modifying the DACL for a Service
- WebLogic8.1试用
- JMS 之Weblogic8.1
- Weblogic8.1 配置总结
- weblogic8.1 license
- Weblogic8.1安装配置
- weblogic8.1-axis2使用
- weblogic8.1安装过程
- weblogic8.1 下载地址
- 清除WebLogic8.1缓存
- No response for the toolbars in BEx Analyzer 2004s
- 交换环境下的会话劫持 so cool
- 2005年秋季《数据库原理及应用》选修课考试安排
- Windows Vista First Glance
- [PS应用]1分钟,教你做撕边效果
- 关于抽象类和接口(转载)
- Modifying the Response in Weblogic8.1
- 抽象类与接口应用(转载)
- DATAGRID资料
- 信科及应用技术学院Java语言程序设计、XML语言选用教材
- GCC 简介
- asp中利用MSXML2.DOMDocument解析xml文件
- 升职了,半个leader,呵呵
- 基本知識
- java 学习笔记