Class HtmlRewriteStream
Stream used while parsing outgoing HTML
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0Syntax
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() |