jwdcfdeveloper
Programmer
I am using the following code to create a token to pass to another part of my application:
<cffunction access="public" name="createToken" output="false" returntype="string" hint="Creates a token.">
<cfscript>
//create token generator instance
myInstance = CreateObject("Java", "TokenGenerator");
getInstance = myInstance.getInstance();
//create vars to hold the parameters
URL = "Payload = "my payload";
IP = cgi.REMOTE_HOST;
//create token data instance and add parameters
tokenData = CreateObject("Java", "TokenData");
myURL = tokenData.setURL(JavaCast("String", akamaiURL));
myPayload = tokenData.setPayload(JavaCast("String", akamaiPayload));
myIP = tokenData.setClientIP(JavaCast("String",akamaiIP));
//now tokenize the data
at = myInstance.generateToken("DMC",tokenData);
</cfscript>
<cfreturn akamaiToken>
</cffunction>
I get a null pointer exception when I try and create the token (at). DMC is an xml file that gets other parameters from besides the three that are set here. It works fine up to that point. I ran the actual Java in a main method and it worked fine, so I know it's not the Java. But for whatever reason, it won't run in my CFC. Any suggestions?
Thanks,
JW
<cffunction access="public" name="createToken" output="false" returntype="string" hint="Creates a token.">
<cfscript>
//create token generator instance
myInstance = CreateObject("Java", "TokenGenerator");
getInstance = myInstance.getInstance();
//create vars to hold the parameters
URL = "Payload = "my payload";
IP = cgi.REMOTE_HOST;
//create token data instance and add parameters
tokenData = CreateObject("Java", "TokenData");
myURL = tokenData.setURL(JavaCast("String", akamaiURL));
myPayload = tokenData.setPayload(JavaCast("String", akamaiPayload));
myIP = tokenData.setClientIP(JavaCast("String",akamaiIP));
//now tokenize the data
at = myInstance.generateToken("DMC",tokenData);
</cfscript>
<cfreturn akamaiToken>
</cffunction>
I get a null pointer exception when I try and create the token (at). DMC is an xml file that gets other parameters from besides the three that are set here. It works fine up to that point. I ran the actual Java in a main method and it worked fine, so I know it's not the Java. But for whatever reason, it won't run in my CFC. Any suggestions?
Thanks,
JW