Skip to content

Instantly share code, notes, and snippets.

@imageaid
Created September 19, 2011 19:29
Show Gist options
  • Save imageaid/1227343 to your computer and use it in GitHub Desktop.
Save imageaid/1227343 to your computer and use it in GitHub Desktop.
Revised $getPathFromRequest internal method for use with URLRewrite
<cffunction name="$getPathFromRequest" returntype="string" access="public" output="false">
<cfargument name="pathInfo" type="string" required="true">
<cfargument name="scriptName" type="string" required="true">
<cfscript>
var returnValue = "";
// ensure that the $pathinfo var is picked up from the URL struct when using URLRewriting via Tomcat/URLRewriteFilter
if (StructKeyExists(url, "$pathinfo"))
arguments.pathInfo = url.$pathinfo;
// we want the path without the leading "/" so this is why we do some checking here
if (arguments.pathInfo == arguments.scriptName || arguments.pathInfo == "/" || arguments.pathInfo == "")
returnValue = "";
else
returnValue = Right(arguments.pathInfo, Len(arguments.pathInfo)-1);
</cfscript>
<cfreturn returnValue>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment