Created
September 19, 2011 19:29
-
-
Save imageaid/1227343 to your computer and use it in GitHub Desktop.
Revised $getPathFromRequest internal method for use with URLRewrite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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