<cfcomponent>
<cffunction name="getCaller" returntype="struct" access="public">
<cfscript>
e = CreateObject("java", "java.lang.Exception");
sts = e.getStackTrace();
foundme = false;
theCaller = StructNew();
for(itr = 1; itr lte ArrayLen(sts); itr = itr + 1) {
className = sts[itr].getClassName();
if(foundme and className contains "2ecf") {
index = Find("2ecf", className);
theCaller.from = Mid(className, 3, index - 3);
break;
}
if(not foundme and className contains "2ecfc") {
foundme = true;
methodName = sts[itr].getClassName();
index = Find("$func", methodName);
theCaller.toMethod = Mid(methodName, index +
5, Len(methodName));
}
}
</cfscript>
<cfreturn theCaller>
</cffunction>
</cfcomponent>Again, the above only works in JDK 1.4. There is a way to make it work with earlier JDKs, but that would be more time consuming both from a development point of view and a performance one.
I also blogged this at http://devilm.com/archives/000044.html.
Matt Liotta President & CEO Montara Software, Inc. http://www.MontaraSoftware.com (888) 408-0900 x901
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
