Fusebox Search Engine Safe URLs

The handling of self, myself, and has been enhanced to allow you to specify how the URLs are constructed by the framework.

xfa now allows child tags: parameter can be used to specify URL parameter name / value pairs instead of specifying them directly in the XFA value.

In other words, instead of saying:

<xfa name="edit" value="app.edittask&id=#attributes.id#"/>

you would now say:

<xfa name="edit" value="app.edittask">
<parameter name="id" value="#attributes.id#"/>
</xfa>

This cleanly separates the actual XFA - the fuseaction - from the various URL parameters in the target URL.

Fusebox uses fusebox.xml parameters to construct the URL parameter string. The following (optional) fusebox.xml parameters have been added:

Parameter'DefaultDescription

selfindex.cfmIntended to be the base script name used to generate URLs

queryStringStart?The string to use between the script name and any URL parameters

queryStringSeparator&The string to use to separate individual URL parameters

queryStringEqual=The string to use between a URL parameter name and its value

myself This is constructed as self & queryStringStart & fuseactionVariable & queryStringEqual by default but can be overridden

This means that you can construct so-called "Search Engine Safe" URLs automatically by specifying different values for these parameters. For example, by setting them all to "/", the XFA shown above becomes:

app.edittask/id/#attributes.id#

and the myself value becomes:

index.cfm/fuseaction/

Bear in mind that you'll need to use htmlEditFormat() to ensure XHTML compliant HTML is generated.

In addition, you can now specify an XFA name in the verb:

<relocate xfa="edit"/>

This would construct a redirect to the full URL implied by myself and the XFA:

index.cfm/fuseaction/app.edittask/id/#attributes.id#

You can retrieve the framework-generated values for self and myself, as well as updating them on a per-request basis using these new methods on the myFusebox object:

MethodArgumentsDescription

getSelf Returns the current version of self

setSelfstring selfChanges the current version of self and recalculates myself

getMyself Returns the current version of myself

setMyselfstring myselfChanges the current version of myself, allowing non-standard base URLs to be created

Server Side URL re-Writing

If you want to do the purest form of SES URLs (http://site.com/controller/action) , it requires the removal of the index.cfm which involves having to do some URL rewriting on the web server side. No framework that I know of can avoid URL rewriting if you want to remove the index.cfm

IIS7.5 supports it natively using the web.config or using built-in wizards; Apache has mod_rewrite via .htaccess. There are also 3rd party products for IIS6/7.

While Fusebox 5 does nativly support "SES URL's", the index.cfm file is still within the URL; as follows:

http://127.0.0.1:8500/intranet/index.cfm/fuseaction/app.welcome

FUSEBOX_PARAMETERS.queryStringStart = "/";
FUSEBOX_PARAMETERS.queryStringSeparator = "/";
FUSEBOX_PARAMETERS.queryStringEqual = "/

Additional Mappings & Railo (servlet-mapping)

For url pattern matching to work in Railo on Tomcat, you can use the web.xml file and add the following:

<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>*.cfm</url-pattern>
<url-pattern>*.cfml</url-pattern>
<url-pattern>*.cfc</url-pattern>
<url-pattern>*.cfm/*</url-pattern>
<url-pattern>*.cfml/*</url-pattern>
<url-pattern>*.cfc/*</url-pattern>
<url-pattern>/*.cfm/*</url-pattern>
<url-pattern>/cfbuilder/site1/index.cfm/*</url-pattern>
</servlet-mapping>