+ Start a Discussion
nathanael.mnathanael.m 

UrlRewriter and apex:include

I've discovered some strange behaviour with the Url Rewriter. I've implemented the Site.UrlRewriter class, the class created doesn't actually do any rewriting, it passes the page references through untouched. I then created a very basic VisualForce Page that has some text and an apex:include in it and nothing else. I include the FileNotFound page. When I visit my page all I get back is the Doctype.  Interestingly enough, the debug log indicates that everthing executes and completes, I just get a blank page. If I take the apex:include out everything is fine and the Url Rewriter works flawlessly.

 

Anyone else run into this?

 

Nathanael

RyanGuestRyanGuest

Can you provide some more info on what your VF page looks like?

 

I've been able to use apex:include with the URL Rewriter. It sounds to me like you are doing something like this:

 

<apex:page showHeader="false" standardStylesheets="false" >
	This is some example text
	<apex:include pageName="FileNotFound"/>
</apex:page>

 

 

With a Rewriter like this:

 

 

global class ARewriter implements Site.UrlRewriter {
   
    global PageReference mapRequestUrl(PageReference myOriginalUrl){
        return myOriginalUrl;
    }
    global List<PageReference> generateUrlFor(List<PageReference> myOriginalUrls){
        return myOriginalUrls;
    }
}

 

 

 

 

Am I missing something?

nathanael.mnathanael.m

That's exactly right, almost the same line for line. All I'm getting back is the Doctype

 

I too have been able to use UrlRewriting with apex:include but that was during the pilot awhile back.

 

I'll check again, maybe a patch went through....

nathanael.mnathanael.m

Just tried it again... still running into the issue. Did you manage to get it to work?

nathanael.mnathanael.m

I've isolated the issue. It turns out that the UrlRewriter causes an error on the page when the apex:include is used in the following way.

 

<apex:include pageName="{!ref}"/>

where ref is a PageReference returned by the page controller. The error returned is:

 

* include pageName&gt;. Please set the attribute to a Visualforce page name.

 

With url rewriting turned off the page works fine.