Hi,
Have u set the http headers properly? If we don't set the headers properly
browser will throw up the dialog box saying save/open it.
Here is what I tried and what I found working on Tomcat 4.1.29, IE 6.0
Inside doGet() or doPost() -
String acceptEncodingHeaderStr = request.getHeader("Accept-Encoding");
System.out.println("acceptEncodingHeaderStr :
"+acceptEncodingHeaderStr);
boolean supportGZip = false;
if(acceptEncodingHeaderStr != null) {
if( (acceptEncodingHeaderStr.toLowerCase().indexOf("gzip")) >
-1 )
supportGZip = true;
}
if(supportGZip) {
//Sets the proper headers
response.setHeader("Content-Encoding", "gzip");
response.setHeader("Content-Type","text/html");
GZIPOutputStream gzos = new
GZIPOutputStream(response.getOutputStream());
StringBuffer sb = new StringBuffer();
sb.append("This is thru zipped output stream");
gzos.write(sb.toString().getBytes());
gzos.close();
}
Thanks & Regards,
Nirmal
-----Original Message-----
From: BILODEAU Guillaume SOFRECOM [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 8:55 PM
To: Struts Users Mailing List
Subject: Re: REPOST: GZipping response with Servlet 2.2 / Struts 1.0
GZip compression on the web server using mod_gzip seemed like a suitable
solution to my problem, but unfortunately it is not usable in our
environment:
the web server is shared by multiple applications and such a configuration
modification would require the approval of all other teams (which would be
incredibly lengthy, painful, and would probably end up being rejected).
Compression definitely has to be done at a code level. Too bad we don't
have
servlet filter support... :(
Thanks,
GB
Martin Gainty a �crit :
> Have you posted this to the GZIP Discussion list at
[EMAIL PROTECTED]
> Regards,
> -Martin
> ----- Original Message -----
> From: "BILODEAU Guillaume SOFRECOM" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, February 05, 2004 8:59 AM
> Subject: REPOST: GZipping response with Servlet 2.2 / Struts 1.0
>
> > Hi everyone,
> >
> > I have read the following reply (rather old) in the archives:
> >
> > >In servlet 2.2 environments, you basically won't be able to do this.
> > But
> > >in servlet 2.3 environments, you can create a Filter to do the
> > compression
> > >for you, on output from either servlets or JSP pages.
> >
> > This was in response to a question about adding GZip compression to a
> > JSP in a Struts environment. I have tried doing a similar thing by
> > extending the ActionServlet class and wrapping the original response in
> > a GZip-compressed response, but without any success: I constantly end up
> > receiving a download dialog on my browser (as if I were sending a zipped
> > file) or getting ClassCastExceptions (with IBM WebSphere classes being
> > expected). I suspect the forward mechanism is the cause to all that.
> >
> > Can you confirm that it is impossible to add such support for
> > compression even by extending the ActionServlet? Would there be any
> > other mechanism to compress the response sent to the client? Any
> > pointers on the web? I am using the servlet 2.2 API on WebSphere 4.0.3.
> >
> > Thanks a lot,
> > Guillaume
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]