You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vijay Venkataraman <vi...@ltp.soft.net> on 2007/08/14 09:27:32 UTC

[OT] Gzip compression of script files

Hi,
I have javascript/css files and looking at GZipping them and sending it 
to the browser. I am aware that i can do a GZip compression during 
runtime using a filters, by writing the content to GZipOutputStream. I 
am just wondering if it is possible to GZip these files during build 
time and then simply serve them during a request(run time) from the 
filter. I haven't seen any such example. Possibly i am missing some thing.

Can anyone let me know, if it is achievable? If not why? Any pointers 
would be great.

Cheers,
Vijay.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Gzip compression of script files

Posted by Vijay Venkataraman <vi...@ltp.soft.net>.
Hi Mike,
Thanks for letting me know about this. I will take care to test it on 
slow machines.

Vijay

Mike Baroukh wrote:
> I had problems on IE where compression of gzip didn't works.
> On the first page load, we had javascript error.
> On the second page load, it works because the ungzipped file was in 
> cache.
> If we clear browser cache, we have the error again ...
>
> It seems to happened It happend on slow machines.
>
> so, be careful with it. I personally never gzip .js.
>
> Mike
>
>
> Sebastian Kolbe a écrit :
>> Hello,
>>
>> First of all: You should open a new thread for new questions. 
>> Answering to
>> existing threads might conceal your message for most people.
>>
>> Anyway:
>> Compressing javascript, css and other files is possible if the browser
>> supports this.
>> The simplest solution for this is to install a webserver (i.e. apache)
>> additional
>> to your application server so that a request goes through the web
>> server. This webserver
>> can be configured to compress content, probably also HTML files or other
>> content;
>> look for 'mod_deflate'.
>> If everything is right you should then have a transparent compression
>> for selected
>> filetypes w/o needing to compress anything "manually".
>>
>> An other approach is to use a javascript "compressor" like
>> http://compressor.ebiene.de/  which converts/eliminates white spaces and
>> word wrapping.
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Gzip compression of script files

Posted by Mike Baroukh <mb...@cardiweb.com>.
I had problems on IE where compression of gzip didn't works.
On the first page load, we had javascript error.
On the second page load, it works because the ungzipped file was in cache.
If we clear browser cache, we have the error again ...

It seems to happened It happend on slow machines.

so, be careful with it. I personally never gzip .js.

Mike


Sebastian Kolbe a écrit :
> Hello,
> 
> First of all: You should open a new thread for new questions. Answering to
> existing threads might conceal your message for most people.
> 
> Anyway:
> Compressing javascript, css and other files is possible if the browser
> supports this.
> The simplest solution for this is to install a webserver (i.e. apache)
> additional
> to your application server so that a request goes through the web
> server. This webserver
> can be configured to compress content, probably also HTML files or other
> content;
> look for 'mod_deflate'.
> If everything is right you should then have a transparent compression
> for selected
> filetypes w/o needing to compress anything "manually".
> 
> An other approach is to use a javascript "compressor" like
> http://compressor.ebiene.de/  which converts/eliminates white spaces and
> word wrapping.
> 

-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Gzip compression of script files

Posted by Vijay Venkataraman <vi...@ltp.soft.net>.
Sebastin,
Thanks for all the information and pointers. Hmm  i didn't realize that 
i meddled with another thread. Group i am very sorry for the mistake. I 
just accomplished what i wanted, it was more of a bug that is why i 
didn't get it to work.

I do understand that i can get it done this done at container / web 
server config level or at the code level. Nice link if others are think 
in these terms. http://www.seifi.org/?p=482

Thanks,
Vijay


Sebastian Kolbe wrote:
> Hello,
>
> First of all: You should open a new thread for new questions. Answering to
> existing threads might conceal your message for most people.
>
> Anyway:
> Compressing javascript, css and other files is possible if the browser
> supports this.
> The simplest solution for this is to install a webserver (i.e. apache)
> additional
> to your application server so that a request goes through the web
> server. This webserver
> can be configured to compress content, probably also HTML files or other
> content;
> look for 'mod_deflate'.
> If everything is right you should then have a transparent compression
> for selected
> filetypes w/o needing to compress anything "manually".
>
> An other approach is to use a javascript "compressor" like
> http://compressor.ebiene.de/  which converts/eliminates white spaces and
> word wrapping.
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Gzip compression of script files

Posted by Sebastian Kolbe <sk...@gmx.net>.
Hello,

First of all: You should open a new thread for new questions. Answering to
existing threads might conceal your message for most people.

Anyway:
Compressing javascript, css and other files is possible if the browser
supports this.
The simplest solution for this is to install a webserver (i.e. apache)
additional
to your application server so that a request goes through the web
server. This webserver
can be configured to compress content, probably also HTML files or other
content;
look for 'mod_deflate'.
If everything is right you should then have a transparent compression
for selected
filetypes w/o needing to compress anything "manually".

An other approach is to use a javascript "compressor" like
http://compressor.ebiene.de/  which converts/eliminates white spaces and
word wrapping.

-- 
Sebastian

Vijay Venkataraman schrieb:
> Hi,
> I have javascript/css files and looking at GZipping them and sending
> it to the browser. I am aware that i can do a GZip compression during
> runtime using a filters, by writing the content to GZipOutputStream. I
> am just wondering if it is possible to GZip these files during build
> time and then simply serve them during a request(run time) from the
> filter. I haven't seen any such example. Possibly i am missing some
> thing.
>
> Can anyone let me know, if it is achievable? If not why? Any pointers
> would be great.
>
> Cheers,
> Vijay.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org