[CLOSED] GZiped StoreResult

  1. #1

    [CLOSED] GZiped StoreResult

    Hi folks, AFAICS, the store result uses GZip, so it was expected to transfer 37 kb rather than 260 kb (unziped)

    Any ideas?



    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" GZip="true" />
        <ext:GridPanel runat="server" Title="Records" Frame="false" Width="500" Height="500">
            <Store>
                <ext:Store AutoLoad="true" ID="_str" runat="server">
                    <Proxy>
                        <ext:AjaxProxy Url="/Example/LoadFakeRecords/">
                            <ActionMethods Read="POST" />
                            <Reader>
                                <ext:JsonReader RootProperty="data" />
                            </Reader>
                        </ext:AjaxProxy>
                    </Proxy>
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="ID" Type="String" />
                                <ext:ModelField Name="Name" Type="String" />
                                <ext:ModelField Name="Address" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Text="ID" DataIndex="ID" runat="server" />
                    <ext:Column Text="Name" DataIndex="Name" runat="server" />
                    <ext:Column Text="Address" DataIndex="Address" runat="server" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
    </body>
    </html>
    public class ExampleController : System.Web.Mvc.Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public StoreResult LoadFakeRecords()
        {
            List<Person> lst = new List<Person>();
    
            for (int index = 0; index < 5000; index++)
            {
                lst.Add(new Person
                {
                    ID = index,
                    Name = string.Format("Name{0}", index),
                    Address = string.Format("Address{0}", index)
                });
            }
    
            var result = new StoreResult(lst, lst.Count());
    
            var serializedResult = JSON.Serialize(result);
    
            //260KB
            decimal sizeOfResult = System.Text.Encoding.UTF8.GetBytes(serializedResult).Length / 1024;
    
            //37kb
            decimal sizeOfGzipedResult = CompressionUtils.GZip(serializedResult).Length / 1024; 
    
            return result;
        }
    }
    
    public class Person
    {
        public int ID { get; set; }
    
        public string Name { get; set; }
    
        public string Address { get; set; }
    }


    StoreResult
    public override void ExecuteResult(ControllerContext context)
    {
        NodeCollection nodes = this.Data as NodeCollection;
        StoreResponseData storeResponse = new StoreResponseData(this.IsTree || nodes != null);
        if (nodes != null)
        {
            storeResponse.Data = ((NodeCollection)this.Data).ToJson();
        }
        else
        {
            if (this.Model != null)
            {
                storeResponse.Data = ModelSerializer.Serialize(this.Data, this.Model, this.IgnoreExtraFields);
            }
            else
            {
                storeResponse.Data = JSON.Serialize(this.Data);
            }
        }
    
        storeResponse.Total = this.Total;
        storeResponse.Success = this.Success;
        storeResponse.Message = this.Message;
        storeResponse.Return();
    }
    StoreResponseData
    [Description("")]
    public virtual void Return()
    {
        CompressionUtils.GZipAndSend(this);
    }
    Attached Thumbnails Click image for larger version. 

Name:	received.png 
Views:	38 
Size:	9.9 KB 
ID:	16641  
    Last edited by Daniil; Nov 26, 2014 at 7:15 PM. Reason: [CLOSED]
  2. #2
    On ie, the received column shows the total size of uncompressed data. But on response header it's possible to see that the data is compressed as expected. On Chrome, the received column shows the size of compressed data, as i expected.

    Please, mark this thread as closed.

Similar Threads

  1. [CLOSED] StoreResult & DataTable
    By bogc in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 06, 2013, 4:52 AM
  2. [CLOSED] Extend StoreResult
    By RCM in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 11, 2013, 8:36 AM
  3. Replies: 9
    Last Post: Jan 11, 2013, 2:38 PM
  4. [CLOSED] StoreResult Problem
    By mcfromero in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 21, 2012, 6:55 AM
  5. Replies: 6
    Last Post: Jul 03, 2012, 5:46 PM

Posting Permissions