I thoght it found all the links, and reroutet them to the Current UrlRewriter
The used UrlRewriteProvider (typically FriendlyUrlRewriteProvider) instance "delivers" instances of HtmlRewriteToExternal (typically instances of FriendlyHtmlRewriteToExternal). The instance of HtmlRewriteToExternal is then responsible to deliver the Stream and RewritePipe instances (the stream instance is then hooked up to httpApplication.Context.Response.Filter) used at parsing the html output. The built in implementation of the Stream (HtmlRewriteStream) uses an instance of HtmlRewritePipe.
So the RewritePipe instance is responsible for the actual html parsing.
The reason for this design is to make it modular, you can e.g. reuse the built in FriendlyUrlRewriteProvider but replace the actual html parser used. It also makes it possible to hookup to events at different levels, RewritePipe exposes events that are raised for every parsed element/attribute/value in the Html while the UrlRewriteProvider exposes events on a higher level e.g. when an url is parsed.
When I debug the code, what I see is the RewritePipe parsing through every tag, then called FriendlyUrlRewriteProvider to have URLs rewritten. Is this correct?
Besides allowing the rerwite provider to fix the links, is the RewritePipe used for anything else by EPiServer at the default? Is there any documentation about how to swap it out for something else?
It is correct that the class FriendlyHtmlRewriteToExternal sets up an eventlistner to RewritePipe.HtmlRewriteUrl. In the eventhandler it then delegates the actual Url rewriting to the configured UrlRewriteProvider (that during this raises its url related events).
HtmlRewritePipe is used in PropertyXhtmlString that uses it to parse the property value for dynamic content and permanent links (in CMS6R2 PropertyXhtmlString has been changed so it uses our own parser HtmlStreamReader that resides in EPiServer.Framework). HtmlRewritePipe is also used at export to find links in xHtml properties to be able to keep links intact durign export/import and mirroring.
I don't think there is any documentation regarding swapping parser (I do not know if that is something we "officially" support) and I have not heard about that anybody has done that either.
Can someone explain what the HtmlRewritePipe does, exactly?
I thought it existed to rewrite unfriendly links to friendly links, but I see that the FriendlyUrlRewriteProvider provides that functionality in the ConvertToExternalInternal method.
So...what is the RewritePipe doing?