Class ResponseFilterStream

A semi-generic Stream implementation to use with Response.Filter. Uses an event based interface for handling Content capture and transformations with several variations of events that can capture the entire output and transform it or work on actual Response Write() chunks individually.

The key operational interface to this class is via exposed via Events

More information on how this class works: http://www.west-wind.com/weblog/posts/72596.aspx

System.Object
  System.MarshalByRefObject
    System.IO.Stream
      Westwind.Web.ResponseFilterStream
public class ResponseFilterStream : Stream

Class Members

MemberDescription

Constructor

CaptureStream

Event that captures Response output and makes it available as a MemoryStream instance. Output is captured but won't affect Response output.

CaptureString

Event that captures Response output and makes it available as a string. Output is captured but won't affect Response output.

TransformStream

This event allows capturing and transformation of the entire output stream by caching all write operations and delaying final response output until Flush() is called on the stream.

TransformString

Event that can be hooked up to handle Response.Filter Transformation. Passed a string that you can modify and return back as a return value. The modified content will become the final output.

TransformWrite

Event that allows you transform the stream as each chunk of the output is written in the Write() operation of the stream. This means that that it's possible/likely that the input buffer will not contain the full response output but only one of potentially many chunks.

TransformWriteString

Event that allows you to transform the response stream as each chunk of bytep[] output is written during the stream's write operation. This means it's possibly/likely that the string passed to the handler only contains a portion of the full output. Typical buffer chunks are around 16k a piece.

Close

public virtual void Close()

Flush

Override flush by writing out the cached stream data

public virtual void Flush()

Read

public virtual int Read(Byte[] buffer,     int offset,     int count)

Seek

public virtual long Seek(long offset,     SeekOrigin direction)

SetLength

public virtual void SetLength(long length)

Write

Overriden to capture output written by ASP.NET and captured into a cached stream that is written out later when Flush() is called.

public virtual void Write(Byte[] buffer,     int offset,     int count)

CanRead

CanSeek

CanWrite

Length

Position

Example

ResponseFilterStream filter = new ResponseFilterStream(Response.Filter);
filter.TransformStream += filter_TransformStream;
Response.Filter = filter;

Requirements

Namespace: Westwind.Web
Assembly: westwind.web.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic