|
Rank: Member Groups: Member
Joined: 8/29/2007 Posts: 20
|
Hello,
I am trying to use the AJAXUpload component in a production setting and notice that eo_web.ashx handler is requesting seven scripts in separate requests, and on top of that these scripts are not being sent to the browser via gzip if the browser supports it.
I need the ability to combine these seven scripts (statically or at runtime) and to provide them gzipped. The use of the component is adding 120.20kb to my page! That is not an acceptable payload. How can I receive these resources another way?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, See detailed instruction here: http://www.essentialobjects.com/ViewDoc.aspx?t=InstallationAndDeployment%2fdeploy.htmlSearch for "Using physical script files". You will not be able to combine them into one file, even if you could, it won't make much of a difference. In normal case, the script files are downloaded to the client once and cached by the browsers. Thanks
|
|
Rank: Member Groups: Member
Joined: 8/29/2007 Posts: 20
|
I tried as you suggested. The physical files do not use gzip compression, and do not set expires headers (they do have an ETag). This still requires 120.20kb of download to the client. Whether or not the content is cached on the browser, this is still too high a price for initial user experience especially on T1 connections. Adding compression to a handler is essential for me. Ajax Control Toolkit, Telerik RadControls, all deliver content through handlers as gzipped by default. Can I enable this, can I send you source code to add to the .ashx? This feels like a missing feature to me.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
Please do not blame GZip on us. :) Compression is an IIS setting, it has nothing to do with us. Once you use physical script file, it's just a JavaScript file sitting on your server and is no special than any other file on your server. We render a link to the JavaScript file to indicate that we want to use it and that's it.
Thanks
|
|
Rank: Member Groups: Member
Joined: 8/29/2007 Posts: 20
|
Hello,
While I understand that compression can be turned on via IIS my web application uses GZip compression at the page level because I don't like to perform wholesale compression of everything. Telerik RadControls use GZip at the handler level, as does the ToolkitScriptManager, both via the ScriptResource handler. So if you've decided not to support the situation where an encoding stream can be added to the handler, then say that, but it's a reality that GZip can be served from handlers without having to rely on IIS. This is especially important for shared hosting when you don't have permissions to affect IIS settings.
Sure the javascript is a physical file like any other but a handler is a handler like any other. Here's source code for a base class that does exactly what I'm asking you to do and doesn't require any changes, only that it is called in the ProcessRequest method.
public abstract class CompressionHandler : IHttpHandler { public abstract void ProcessRequest(HttpContext context);
public static Stream Compress(HttpContext context, HttpResponse response, Stream stream) { string acceptEncoding = context.Request.Headers["Accept-Encoding"]; if (!String.IsNullOrEmpty(acceptEncoding)) { acceptEncoding = acceptEncoding.ToLower(); if (acceptEncoding.Contains("gzip")) { response.AddHeader("Content-encoding", "gzip"); stream = new GZipStream(stream, CompressionMode.Compress); } else if (acceptEncoding.Contains("deflate")) { response.AddHeader("Content-encoding", "deflate"); stream = new DeflateStream(stream, CompressionMode.Compress); } } return stream; }
public virtual bool IsReusable { get { return true; } } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Good points. I guess that will come soon then!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
This has now been implemented in build 2007.2.39.
|
|