Class HtmlRewriteStream

Stream used while parsing outgoing HTML

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
HtmlRewriteStream
Implements
System.IDisposable
Inherited Members
System.IO.Stream.Null
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.ReadByte()
System.IO.Stream.WriteByte(System.Byte)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.CreateObjRef(System.Type)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class HtmlRewriteStream : PooledMemoryBufferStream, IDisposable
Remarks

Use this as a Response.Filter-filter. It will parse outgoing HTML and find links to the site and transform them to friendly urls and/or language-specifying urls according to what was done during the rewriting of the original request. It is dependent on information in Context.Item-collection to determine just how the rewriting is to occur. This is set by UrlRewriteModule normally.

For efficiency reasons, this stream will primarily attempt to buffer in memory first, and failing that, should switch over to a separate intermediary threaded pipe-implementation (not yet implemented).

Constructors

HtmlRewriteStream(Object, Stream, Encoding)

Initializes a new instance of the HtmlRewriteStream class.

Declaration
public HtmlRewriteStream(object context, Stream sink, Encoding encoding)
Parameters
Type Name Description
System.Object context

The context of the rewrite

System.IO.Stream sink

The sink (the original output stream)

System.Text.Encoding encoding

The encoding.

Properties

HtmlRewritePipe

Gets or sets the HTML rewrite pipe to be used when parsing

Declaration
public HtmlRewritePipe HtmlRewritePipe { get; set; }
Property Value
Type Description
HtmlRewritePipe

The HTML rewrite pipe.

Sink

Gets or sets the sink, I.e. the final destination for the data written to us, after it has been rewritten (the consumer).

Declaration
protected Stream Sink { get; set; }
Property Value
Type Description
System.IO.Stream

The sink (the original output stream)

Methods

Close()

Close the stream and Dispose() of the memory buffers. This is where we actually call the HtmlRewritePipe class to rewrite from a complete source stream to the provided sink stream. We can't connect them directly, since the SgmlReader must be able to read the stream to end, so we must buffer or implement a thread or co-routine based pipe.

Declaration
public override void Close()
Overrides

Dispose(Boolean)

Clean up. This is important since we want to keep track of re-usable buffers from the backing memory store.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

true of called via Dispose(), false if called by framework Finalize()

Overrides

Implements

System.IDisposable

Extension Methods