Ejemplo n.º 1
0
        /// <summary>
        /// Creates an <see cref="ODataAsynchronousResponseMessage"/> for writing an operation of an async response - implementation of the actual functionality.
        /// </summary>
        /// <returns>The message that can be used to write the response.</returns>
        private ODataAsynchronousResponseMessage CreateResponseMessageImplementation()
        {
            var responseMessage = ODataAsynchronousResponseMessage.CreateMessageForWriting(rawOutputContext.OutputStream, this.WriteInnerEnvelope);

            responseMessageCreated = true;

            return(responseMessage);
        }
        /// <summary>
        /// Returns an <see cref="ODataAsynchronousResponseMessage"/> for reading the content of an async response - implementation of the actual functionality.
        /// </summary>
        /// <returns>The message that can be used to read the response.</returns>
        private ODataAsynchronousResponseMessage CreateResponseMessageImplementation()
        {
            int statusCode;
            IDictionary <string, string> headers;

            this.ReadInnerEnvelope(out statusCode, out headers);

            return(ODataAsynchronousResponseMessage.CreateMessageForReading(this.rawInputContext.Stream, statusCode, headers));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Writes the envelope for the inner HTTP message.
        /// </summary>
        /// <param name="responseMessage">The response message to write the envelope.</param>
        private void WriteInnerEnvelope(ODataAsynchronousResponseMessage responseMessage)
        {
            // Write response line.
            string statusMessage = HttpUtils.GetStatusMessage(responseMessage.StatusCode);

            this.rawOutputContext.TextWriter.WriteLine("{0} {1} {2}", ODataConstants.HttpVersionInAsync, responseMessage.StatusCode, statusMessage);

            // Write headers.
            if (responseMessage.Headers != null)
            {
                foreach (var headerPair in responseMessage.Headers)
                {
                    string headerName  = headerPair.Key;
                    string headerValue = headerPair.Value;
                    this.rawOutputContext.TextWriter.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0}: {1}", headerName, headerValue));
                }
            }

            // Write CRLF.
            this.rawOutputContext.TextWriter.WriteLine();

            // Flush the writer since we won't be able to access it anymore.
            this.rawOutputContext.TextWriter.Flush();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Writes the envelope for the inner HTTP message.
        /// </summary>
        /// <param name="responseMessage">The response message to write the envelope.</param>
        private void WriteInnerEnvelope(ODataAsynchronousResponseMessage responseMessage)
        {
            // Write response line.
            string statusMessage = HttpUtils.GetStatusMessage(responseMessage.StatusCode);
            this.rawOutputContext.TextWriter.WriteLine("{0} {1} {2}", ODataConstants.HttpVersionInAsync, responseMessage.StatusCode, statusMessage);

            // Write headers.
            if (responseMessage.Headers != null)
            {
                foreach (var headerPair in responseMessage.Headers)
                {
                    string headerName = headerPair.Key;
                    string headerValue = headerPair.Value;
                    this.rawOutputContext.TextWriter.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0}: {1}", headerName, headerValue));
                }
            }

            // Write CRLF.
            this.rawOutputContext.TextWriter.WriteLine();

            // Flush the writer since we won't be able to access it anymore.
            this.rawOutputContext.TextWriter.Flush();
        }
Ejemplo n.º 5
0
 public void Execute(ODataAsynchronousResponseMessage responseMessage)
 {
     this.requestHandler.Process(this.requestMessage, responseMessage);
 }