/// <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; }
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; }
public DelegateBodyWriter(StreamWriterDelegate writer) : base(false) { this.writer = writer; }
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; }