Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="streamWriter"></param>
 /// <param name="optimizedContentLengthBeforeMakeStream">Не обязателен, но при его задании чтение Length не будет приводить к созданию стрима с предварительной подготовкой</param>
 public ContentProviderToStreamWritable(StreamWriterDelegate streamWriter,
                                        ContentLengthDelegate optimizedContentLengthBeforeMakeStream = null)
 {
     NotNull.CheckArgument(() => streamWriter);
     _streamWriter = streamWriter;
     _optimizedContentLengthBeforeMakeStream = optimizedContentLengthBeforeMakeStream;
 }
Beispiel #2
0
        public static Message CreateMessage(MessageVersion version, string action, StreamWriterDelegate writer)
        {
            Message message = Message.CreateMessage(version, action, new DelegateBodyWriter(writer));

            message.Properties.Add("BodyFormat", new RelayedHttpBodyFormatHeader(RelayedHttpUtility.FormatStringRaw));
            return(message);
        }
        public static Message CreateMessage(MessageVersion version, string action, string contentType, StreamWriterDelegate writer)
        {
            DelegateBodyWriter bodyWriter = new DelegateBodyWriter(writer);

            Message message = Message.CreateMessage(version, action, bodyWriter);
            message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Raw));

            HttpResponseMessageProperty response = new HttpResponseMessageProperty();
            response.Headers[System.Net.HttpResponseHeader.ContentType] = contentType;  
            message.Properties.Add(HttpResponseMessageProperty.Name, response);

            return message;
        }
Beispiel #4
0
 public DelegateBodyWriter(StreamWriterDelegate writer)
     : base(false)
 {
     this.writer = writer;
 }
Beispiel #5
0
        public static Message CreateMessage(MessageVersion version, string action, string contentType, StreamWriterDelegate writer)
        {
            DelegateBodyWriter bodyWriter = new DelegateBodyWriter(writer);

            Message message = Message.CreateMessage(version, action, bodyWriter);

            message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Raw));

            HttpResponseMessageProperty response = new HttpResponseMessageProperty();

            response.Headers[System.Net.HttpResponseHeader.ContentType] = contentType;
            message.Properties.Add(HttpResponseMessageProperty.Name, response);

            return(message);
        }
 public DelegateBodyWriter(StreamWriterDelegate writer)
     : base(false)
 {
     this.writer = writer;
 }