When dealing with the portlet bridge, and we have a direct url (ie a url hardcode in the page), the bridge will try and encode this value.
For example, if we have a page with an output link:
<h:outputLink value="http://livedemo.exadel.com/photoalbum">PhotoAlbum Application</h:outputLink>
The portletbridge will try and encode the link (http://livedemo.exadel.com/photoalbum) in which the encoding will be delegated to the portlet container. When operating under a normal portlet container this will work fine since it doesn't actually encode the url to something different.
But if we are dealing with wsrp, it will encode the url as a wsrp url, which causes problems. The photoalbum link in this case is a meta refresh, so if wsrp tries to load it as a resource, it will just reload the portal page.
It looks like AbstractExternalContext encodeResourceURL (line 533) is trying to see what type of url it is, and based on the protocol and path if it should encode the url or return it. It looks like its getting confused over what type of link it should be handling.