Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created January 3, 2014 14:16
Show Gist options
  • Save adamcameron/8238504 to your computer and use it in GitHub Desktop.
Save adamcameron/8238504 to your computer and use it in GitHub Desktop.
Code for Railo Group post
// Application.cfc
component {
this.name = "testRest06";
function onApplicationStart(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onApplicationEnd(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onSessionStart(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onSessionEnd(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onRequestStart(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onRequestEnd(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onRequest(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called for #arguments[1]#");
}
function onCfcRequest(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
}
function onError(){
writeLog(file=this.name, text="#getFunctionCalledName()#() called");
throw(object=arguments[1]);
}
}
// Test.cfc
component restPath="/demo" rest=true {
remote string function greet() httpmethod="GET" {
return "G'day World @ #now()#";
}
remote string function error() httpmethod="GET" restpath="/error" {
throw(type="MethodFailedException", message="MethodFailedException was thrown");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment