Ejemplo n.º 1
0
        public void Handle(HttpContext context)
        {
            int i = 0;
            try
            {
                EngineObserverData data = new EngineObserverData()
                {
                    User = _UserFactory.Create(context),
                    FinalData = new Dictionary<string, object>(),
                    Context = context,
                    Commands = Zeus.Domain.ZeusParser.ParseUrl(context.Request.Url.ToString())
                };

                
                for (; i < _Length; i += 1)
                {
                    try
                    {
                        _Observers[i].OnObserve(data);
                    }
                    catch (Exception exc)
                    {
                        throw new Exception(string.Format("Engine error on {0}", _Observers[i].Name), exc);
                    }
                }
            }
            finally
            {
                HttpContextCache.CacheDispose();

            }
        }
Ejemplo n.º 2
0
        public void OnObserve(EngineObserverData data)
        {

                //var data = new Data(){User=user};
                data.FinalData.Add("user", _userdb.Get(data.User.Id));
                var u = string.Format("{0}({1});"
                    , data.Context.Request["callback"]
                    , JsonSerializer.SerializeToString<Dictionary<string, object>>(data.FinalData));


                data.Context.Response.Write(u);



        }