Exemplo n.º 1
0
        /// <summary>
        /// The main routine of the handler. Creates a request message and sends it to the server.
        /// </summary>
        /// <param name="context">The current http context<guer/param>
        public void ProcessRequest(HttpContext context)
        {
            string      requestMsg;
            bool        ok = false;
            string      responseMsg;
            HttpRequest request = context.Request;

            log    = new XWindowsLogger();
            config = new XConfig(request, log);
            srv    = new XServerConnection(log, config);


            if (buildRequestMessage(out requestMsg, request))
            {
                if (srv.connect())
                {
                    if (srv.sendMessage(requestMsg))
                    {
                        if (srv.receiveMessage(out responseMsg))
                        {
                            if (processResponse(ref responseMsg, context))
                            {
                                context.Response.Write(responseMsg);
                                ok = true;
                            }
                        }
                    }
                }
            }

            if (!ok)
            {
                context.Response.Write(ERRORMSG);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="log">A logger to write debug and error messages</param>
 /// <param name="config">A configuration</param>
 public XServerConnection(XLogger log, XConfig config)
 {
     this.config = config;
     this.log    = log;
 }
Exemplo n.º 3
0
        /// <summary>
        /// The main routine of the handler. Creates a request message and sends it to the server. 
        /// </summary>
        /// <param name="context">The current http context<guer/param>
        public void ProcessRequest(HttpContext context)
        {
            string requestMsg;
            bool ok = false;
            string responseMsg;
            HttpRequest request = context.Request;
            log = new XWindowsLogger();
            config = new XConfig(request, log);
            srv = new XServerConnection(log, config);

            if (buildRequestMessage(out requestMsg, request))
            {
                if (srv.connect())
                {
                    if (srv.sendMessage(requestMsg))
                    {
                        if (srv.receiveMessage(out responseMsg))
                        {
                            if (processResponse(ref responseMsg, context))
                            {
                                context.Response.Write(responseMsg);
                                ok = true;
                            }
                        }
                    }
                }
            }

            if (!ok)
            {
                context.Response.Write(ERRORMSG);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="log">A logger to write debug and error messages</param>     
 /// <param name="config">A configuration</param>
 public XServerConnection(XLogger log, XConfig config)
 {
     this.config = config;
     this.log = log;
 }