Swap between SES and traditional URLs on the fly

10 views
Skip to first unread message

Jason Durham

unread,
Nov 4, 2009, 11:46:24 AM11/4/09
to col...@googlegroups.com
This feature may exist, but I'm unable to find it in the
documentation.  My apologies to Luis if he's already documented such a
feature. :)

With another framework, it was simple to swap the entire application
between traditional URLs and SES URLs.  I know we can turn on/off the
SES interceptor rather easily.  However, this doesn't correct all of
the links I've created in a CB application.  For example...

SES URL:
<a href="#event.buildLink('user.edit')#/user/#someVar#">Edit User #someVar#</a>

That link has a "query string" that can't (reasonably) be altered at
runtime.  It would be nice to modify buildLink() to accept a structure
containing query string key/value pairs.

NEW URL:
<cfset qstring = {userID="55", context="foobar"} />
<a href="#event.buildLink(event: 'user.edit', qs: qstring)#">Edit User
#qstring.userID#</a>

Then, we could switch between the following two URLs with a simple setting...

<a href="index.cfm/user/edit/userid/55/context/foobar">Edit User 55</a>
.......or.......
<a href="index.cfrm?event=user.edit&userid=55&context=foobar">Edit User 55</a>


For comparison's sake, the framework I previously used simply used
application variables to compose the link...
<a href="#xit.editUser##myFramework.getApplication().queryStringSeparator#user#myFramework.getApplication().queryStringEqual#55#myFramework.getApplication().queryStringSeparator#context#myFramework.getApplication().queryStringEqual#foobar">Edit
User 55</a>

--
Jason Durham

--
Jason Durham

Luis Majano

unread,
Nov 4, 2009, 4:53:04 PM11/4/09
to col...@googlegroups.com
Jason,

We added this to 3.0.  There is an argument called "queryString" in the buildLink method.  You pass in a query string and the method will convert it to ses or leave it as is.

Luis



Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com
Reply all
Reply to author
Forward
0 new messages