Hi Guys, If any one of u have used this GZIPOutputStream in servlets in order to zip outstream objects (response), please help me out as I'm getting this following problem while trying to zip a response and then "forwarding". To be more specific,
The implementation of GZIPOutputStream in the ControllerServlet has the following problems. The piece of code we introduced in the "service" method of the servlet is as follows: OutputStream out = null; if(req.getHeader("Accept-Encoding").indexOf("gzip")!=-1) { if(req.getHeader("Accept-Encoding").indexOf("x-gzip")!=-1){ res.setHeader("Content-Encoding", "x-gzip"); } else { res.setHeader("Content-Encoding", "gzip"); } System.out.println("Serving the xml in GZIP format"); out = new GZIPOutputStream(res.getOutputStream()); } else { System.out.println("imnside normal stream"); out = res.getOutputStream(); } out.flush(); out.close(); The code is compiling, but at run-time, when the first "forward" method is encountered (forwarding to a JSP) , the following exception is thrown: "IllegalStateException, cannot forward a request for which a ServletOutputStream or PrintWriter has already been obtained". Now, when we replaced the "forward" method with "include", the control is going to the JSP page and fails there. The exception thrown is like this: "IllegalStateException, OutputStream used". It was suggested that since we are already obtaining the OutputStream object from the response object, the JSP, which is expecting the usual request object is not being able to recognise the outputstream object. Then how do we tackle this particular problem? Regards, Gomes > __________________________________________________________________________ > _ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html