Input stream for Hessian requests.

HessianInput is unbuffered, so any client needs to provide its own buffering. InputStream is = ...; // from http connection HessianInput in = new HessianInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer

Inheritance: AbstractHessianInput
Exemplo n.º 1
0
 public HessianInputStream(CHessianInput hessInput)
 {
     this.hessianInput = hessInput;
 }
Exemplo n.º 2
0
        /// <summary>
        /// The Request will be processed here.
        /// The main function in this class
        /// </summary>
        public void ProcessRequest()
        {
            //Get references to sockets input & output streams
            m_stream = new NetworkStream(m_socket, FileAccess.ReadWrite, true);
            MemoryStream memoryStream = new MemoryStream();
            //Reads the Header of HTTP Message
            try {
                ReadHeaders();
            } catch (NotSupportedException e) {
                SendError(500, "Close");
                m_socket.Close();
                m_stream.Close();
                return;
            }
            AbstractHessianInput inHessian = new CHessianInput(m_stream);
            AbstractHessianOutput tempOutHessian = new CHessianOutput(memoryStream);

            /// Proxy object
            CHessianSkeleton objectSkeleton = null;
            try {
                objectSkeleton = new CHessianSkeleton(m_apiType, m_Service);
                objectSkeleton.invoke(inHessian, tempOutHessian);
                WriteResponse(memoryStream.ToArray());
            } catch (Exception e) {
                SendError(500, "Close");
            } finally {
                m_socket.Close();
                m_stream.Close();
            }
        }
Exemplo n.º 3
0
 public HessianInputStream(CHessianInput hessInput)
 {
     this.hessianInput = hessInput;
 }
Exemplo n.º 4
0
        protected override void ProcessRequest(System.Net.HttpListenerContext ctx)
        {
            try
            {
                context = ctx;
                Stream inStream = ctx.Request.InputStream;
                MemoryStream outStream = new MemoryStream();

                //ctx.Response.BufferOutput = true;
                ctx.Response.ContentType = "text/xml";

                AbstractHessianInput inHessian = new CHessianInput(inStream);
                AbstractHessianOutput outHessian = new CHessianOutput(outStream);

                if (m_objectSkeleton == null)
                {
                    //Vieleicht das Interface als API übergeben???
                    m_objectSkeleton = new CHessianSkeleton(this.GetType(), this);
                }

                m_objectSkeleton.invoke(inHessian, outHessian);
                byte[] arrData = outStream.ToArray();
                int intLength = arrData.Length;
                //Set length
                ctx.Response.ContentLength64 = intLength;

                //Write stream
                ctx.Response.OutputStream.Write(arrData, 0, intLength);
                return;
            }
            catch (Exception ex)
            {
                ctx.Response.StatusCode = 500;  // "Internal server error"
                ctx.Response.StatusDescription = ex.Message;
            }
        }