David, As you suspected, this is related to having a "flush" in your applet. The simple solution is to extend your ServletOutputStream with a flush() method that does nothing.
In the future, please ask usage questions on the struts-user list. This list is intended for issues related to developing Struts itself. Have fun, Shai. -----Original Message----- From: David Anderson [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 08:36 To: [EMAIL PROTECTED] Subject: PLEASE REPLY..response wrapping problem as by Sun servlet 2.3 specs, I'm using httpServletResponseWrapper to wrapp response object, the technique didn't work and I didn't yet figured out the cause, I'm deploying my web app to JRUN (I don't know if JRUN4 container is related to the problem) my question is : is there something wrong in the following code in order to wrap response object with struts/tiles ? , is this has to do with "flush=true" in tiles:insert ? or is there any limitations for wrapping response in Struts framework? or is it a Tiles limitation ? in my WEB.XML I wrote : <filter> <filter-name>My Response Wrapper</filter-name> <filter-class>filters.WrapperFilter</filter-class> </filter> <filter-mapping> <filter-name>My Response Wrapper</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> the code in my filter is : WrapperFilter.java ------------------------- package filters; import java.io.IOException; import javax.servlet.Filter; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class WrapperFilter implements javax.servlet.Filter { public void doFilter( javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain ) throws IOException, ServletException { ServletContext context = filterConfig.getServletContext(); HttpServletRequest req = (HttpServletRequest) request; OutputStream out = response.getOutputStream(); out.write("<HR>PRE<HR>".getBytes()); GenericResponseWrapper wrapper = new GenericResponseWrapper((HttpServletResponse) response); chain.doFilter(request, wrapper); out.write(wrapper.getData()); context.log(wrapper.getData().toString()); out.write("<HR>POST<HR>".getBytes()); out.close(); } } //---------------------------------------------------------------------- --------------------------------// GenericResponseWrapper.java : ------------------------------------------- package filters; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import java.io.ByteArrayOutputStream; import java.io.PrintWriter; public class GenericResponseWrapper extends HttpServletResponseWrapper { private ByteArrayOutputStream output; private int contentLength; private String contentType; public GenericResponseWrapper(HttpServletResponse response) { super(response); output = new ByteArrayOutputStream(); } public byte[] getData() { return output.toByteArray(); } public ServletOutputStream getOutputStream() { return new FilterServletOutputStream(output); } public void setContentLength(int length) { this.contentLength = length; super.setContentLength(length); } public int getContentLength() { return contentLength; } public void setContentType(String type) { this.contentType = type; super.setContentType(type); } public String getContentType() { return contentType; } public PrintWriter getWriter() { return new PrintWriter(getOutputStream(), true); } } ======================================================== so when an action URL (http://localhost:8100/emgr/login.do) is called in browser,the page shows NOTHING (empty page) , that login.do action is doing a simple process and than forwarding to tile defininition : main.home.page , the logged error is : jrun.servlet.io.ClosedIOException: Response has been closed at jrun.servlet.io.ClosedOutputStream.write(ClosedOutputStream.java:23) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109) at jrun.servlet.http.WebOutputStream.write(WebOutputStream.java:64) at java.io.OutputStream.write(OutputStream.java:58) at filters.WrapperFilter.doFilter(WrapperFilter.java:176) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) ..... Also I noticed that the same filter is working fine if my action is forwarding to a JSP instead of a tiles definition name so instead of mapping the filter to *.do I mapped it to *.jsp : <filter-mapping> <filter-name>My Response Wrapper</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> that time the page shows correctly with the pre/post text embedded. I'm confused, is it a STRUTS , TILES or JRUN problem ? Regards. _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Confidentiality Notice: This email transmission may contain confidential or legally privileged information that is intended only for the individual or entity named in the e-mail address. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this e-mail is strictly prohibited. If you have received this e-mail transmission in error, please reply to the sender, so that arrangements can be made for proper delivery, and then please delete the message from your inbox. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]