Jump to content

Loading progress of gzip served .babylon files


Vousk-prod.
 Share

Recommended Posts

Hi people,

 

Nice idea to use gzip version of babylon.js file, thank you DK !

the minified version is less than 600k and we use gzip on it to go down less than 100k

 

But to optimise more, I also activated on my apache server automatic gzip of .babylon files

 

(for those that could help, it could be done in the .htaccess :

AddOutputFilterByType DEFLATE application/babylon \                              application/babylonmeshdata

And now I cannot anymore express the loading progress in %, as if progress.lengthComputable is no more computable.

Is that normal or I'm doing something wrong ?

Link to comment
Share on other sites

Knowledge of apache configuration is not actually required to know if content length is being sent.  Here is how to tell in Java.  How it might translate into Java script is unknown, but running this against a url on your server will tell you if you should care.

import java.io.*;import java.net.*;public class Length {	public static void main(String[] args) throws Exception {    	final String addr = (args.length > 0) ? args[0] : "http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a";        DataInputStream response = null;        HttpURLConnection con = null;        try{            final URL site = new URL(addr);            con = (HttpURLConnection) site.openConnection();            // set attributes prior to actually connecting            con.setUseCaches(false);            con.setConnectTimeout(0);            con.setReadTimeout(0);            // connect & check response, store cookie, & get response data            con.connect();                        final int returnCode = con.getResponseCode();            if (returnCode == HttpURLConnection.HTTP_OK){                response = new DataInputStream(con.getInputStream() );                int length = con.getContentLength();                System.out.println( (length != -1) ? "Known length of " + length : "unknown length");            }else{                throw new Exception(addr + " Web site responded: " + con.getResponseMessage() + ", response code: " + returnCode);            }        }finally{            if (response != null) response.close();            if (con != null) con.disconnect();        }    }}

Never ran this myself, but I did chop it out of a program to retrieve / build an Arpabet database, and it compiles.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...