Hi Abhishek

You can check this out: The link contains a tool in which you provide raw HTML and it gives you back the compressed one..

http://www.textfixer.com/html/compress-html-compression.php

On 6/1/2010 12:24 PM, Rupali Gupta wrote:
You can follow these steps to compress a HTML:

In your web directory there's a file called .htaccess.

This file lets you tweak the server settings without having to touch the REAL server configuration files. A feature of the .htaccess file is a system known as the rewrite engine. Basically this lets you use regular expressions to test and modify the url before the web server ever gets around to actually serving the file.

The trick is that with just a few lines put into our .htaccess file we can check to see if the browser can accept compressed files (almost all of them can including Firefox and IE). If the browser can accept compressed files and there's a copy of the file being requested that's been zipped, we can serve the compressed file instead of the uncompressed file. Automatically and invisibly. Completely transparent to your HTML and the user's browsers.

Step 1 -- GZip your files.

First take a common static file like an external javascript (.js) file, or an external (.css) file. Create a GZipped copy ( you can get a free compressor at 7 ZIP. Then upload them to your web server. Remember this only works with STATIC files -- php, cgi, asp, python, perl, ruby and whatnot are all off-limits! If you were working on toolbox.js then your web server should now have a toolbox.js file AND a toolbox.js.gz file (and the .gz file should be dramatically smaller).

Step 2 -- Modify .htaccess

After you've created g-zipped copies of the static files you want to send compressed, make a backup copy of your .htaccess file in your web-server's home directory (or if it doesn't exist, create it). Next, edit the .htaccess file and add the following lines.

RewriteEngine on
RewriteOptions Inherit

#Check to see if browser can accept gzip files.
ReWriteCond %{HTTP:accept-encoding} (gzip.*)

#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$

#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f

#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [L]

The first line turns the rewrite engine on, and the second tells it to keep all the rules being passed down from the master server file (if any). Next we see if the browser can accept gzipped compressed files and if so we make sure the user isn't already requesting a .gz file, finally we check to see if a .gz copy of the file actually exists. If all these conditions are met (browser, no url.gz, actual file exists) then the rewrite engine will silently add .gz to the filename. The .gz will be on the server side only while the file is being sent, it won't show up in the user's location bar or anywhere else.

Step 3 -- All Done!

Once you're done you can test and see if everything is working by simply uploading a .gz file without an uncompressed equivalent (test.html.gz but no test.html), now if you ask for test.html, even if it doesn't exist on your server you should still see a good web page because the server sent you the gzipped copy.




On 6/1/2010 12:08 PM, abhishek jain wrote:
Hi,
Ok,thanks,

how can i zip and send every page from the website. to reduce the size of HTMLs

thanks
abhishek

On Mon, May 31, 2010 at 5:12 PM, Rupali Gupta <r.gup...@mpstechnologies.com <mailto:r.gup...@mpstechnologies.com>> wrote:

    Hi Abhishek
    1. You can do memory profiling by doing performance testing on
    your code.
    2. You can use memcache server and cache data from db once the
    server is started to save the db hits every time. It will make
    application fast.
    3. Try to follow Coding guidelines to save memory and load time
    when fetching data from db. Like use of String Builders instead of
    buffers, creating indexes, minimize duplicate data, using normal
    forms, proper closing of db connections once used etc..

    Let me know if you want other info
    Rupali


    On 5/31/2010 5:05 PM, abhishek jain wrote:

        Dear friends,
        I have recently developed an application in struts 1.x and i
        am thinking is
        there a way i can get to know that is the load time (in
        browser) as per the
        standard or competitive with other applications / websites,

        Can anyone give me some pointers?
        I do would like to know the time graph, ie the query took x
        time and the
        code x time and so on,
        Also can i do caching in struts 1.x and may be zip the HTML
        before sending
        to browser,
        i am using Tomcat 5.x and mysql.
        pl. advice.



---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
<mailto:user-unsubscr...@struts.apache.org>
    For additional commands, e-mail: user-h...@struts.apache.org
<mailto:user-h...@struts.apache.org>








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

Reply via email to