Пример #1
0
        public JMXInterpret(IWebApplicationBase webApp, HttpRequest request, HttpReply reply)
        {
            this.request = request;
            this.reply   = reply;

            app = (DodoApplication)webApp;
        }
Пример #2
0
        public override void ArrivedAtDestination(Node overlayNode, Message m)
        {
            /*
             * HttpReply reply = new HttpReply(this);
             * reply.LoadFile("c:\\eula.1028.txt");
             * overlayNode.SendReply(m.source, reply, Connection == "close");
             */

            Node.LogAppendLine("Request Host: {0}", Host);

            WebApplication      app        = overlayNode.Apps[Host] as WebApplication;
            IWebApplicationBase baseForExt = null;

            Node.LogAppendLine("Total apps: {0}", overlayNode.Apps.GetArray().Length);

            if (app != null)
            {
                Node.LogAppendLine("Found App for: {0}", Host);
            }

            // si no hay ninguna aplicación para procesar la petición
            // intentamos utilizar la aplicación por defecto
            if (app == null)
            {
                app = overlayNode.WebApplicationDefault as WebApplication;
            }

            HttpContext context = new HttpContext(overlayNode, this, app);

            if (app != null)
            {
                /*
                 * string ext = Path.GetExtension(RequestUrl);
                 * if (!String.IsNullOrEmpty(ext))
                 *  app.ExtList.TryGetValue(ext, out baseForExt);
                 */

                // guardamos el contexto en el thread actual
                WebApplication.CurrentContext = context;

                // ejecutamos la aplicación
                // if (baseForExt == null)
                //  app.GetReply(context);

                app.SetHomePage(context);
                app.GetReply(context);

                // else
                //baseForExt.GetReply(overlayNode, context);
            }

            overlayNode.SendReply(context.Reply, m.Source, Connection == "close");
        }
Пример #3
0
        public void Remove(App app, object key)
        {
            try
            {
                lock (sync)
                {
                    if (apps.ContainsKey(key))
                    {
                        IWebApplicationBase tmp = app as IWebApplicationBase;
                        if (tmp != null && tmp.Host != null)
                        {
                            appsHtml.Remove(tmp.Host);
                        }

                        apps.Remove(key);
                    }
                }
            }
            catch (KeyNotFoundException) { }
        }
Пример #4
0
        public void Add(App app, object key)
        {
            try
            {
                lock (sync)
                {
                    if (!apps.ContainsKey(key))
                    {
                        IWebApplicationBase tmp = app as IWebApplicationBase;
                        if (tmp != null)
                        {
                            appsHtml.Add(tmp.Host, tmp);
                        }

                        apps.Add(key, app);
                    }
                }
            }
            catch (Exception err)
            {
                Node.LogAppendLine(err);
            }
        }