This commit is contained in:
msyu
2024-10-23 11:17:42 +03:00
commit ab5c944862
380 changed files with 55823 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/basicauth">
<cffunction name="get">
<cfargument name="username" default="" />
<cfargument name="password" default="" />
<cfreturn representationOf(arguments) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,11 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/conflict/{URI}, /conflict/{URI}" hint="I have multiple uris">
<cffunction name="get">
<cfargument name="uri" type="string" default="0" />
<cfset local.res = {} />
<cfset local.res.uri = arguments.uri />
<cfreturn representationOf(local.res) />
</cffunction>
</cfcomponent>
+27
View File
@@ -0,0 +1,27 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo/{id}" hint="I am the component hint.">
<cfproperty name="dependency1" />
<cffunction name="get" hint="I am the function hint.">
<cfargument name="id" hint="I am the argument hint." />
<cfset local.headers = {}/>
<cfset local.headers['x-dude'] = "dude!" />
<cfset local.res = {} />
<cfset local.res["id"] = arguments.id />
<cfif structKeyExists(arguments, "dataFromOTR")>
<cfset local.res.dataFromOTR = arguments.dataFromOTR />
</cfif>
<cfreturn representationOf(local.res).withStatus(999).withHeaders(local.headers) />
</cffunction>
<cffunction name="put">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
<cffunction name="post">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,38 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo/tunnel/{id}">
<cffunction name="get">
<cfargument name="id" />
<cfset var echo = {} />
<cfset echo.actualMethod = "get" />
<cfreturn representationOf(echo) />
</cffunction>
<cffunction name="put">
<cfargument name="id" />
<cfset var echo = {} />
<cfset echo.actualMethod = "put" />
<cfreturn representationOf(echo).withStatus(200) />
</cffunction>
<cffunction name="post">
<cfargument name="id" />
<cfset var echo = {} />
<cfset echo.actualMethod = "post" />
<cfreturn representationOf(echo).withStatus(201) />
</cffunction>
<cffunction name="delete">
<cfargument name="id" />
<cfset var echo = {} />
<cfset echo.actualMethod = "delete" />
<cfreturn representationOf(echo).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,26 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo_regex/{id:\d{5}}">
<cffunction name="get">
<cfargument name="id" />
<cfset local.headers = {}/>
<cfset local.headers['x-dude'] = "dude!" />
<cfreturn representationOf(arguments).withStatus(999).withHeaders(local.headers) />
</cffunction>
<cffunction name="put">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
<cffunction name="post">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
<cffunction name="setDependency2">
<cfargument name="dependency2" />
<cfset this.dependency2 = arguments.dependency2 />
</cffunction>
</cfcomponent>
+21
View File
@@ -0,0 +1,21 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo_alias/{id}, /echo_alias" hint="I have multiple uris">
<cffunction name="get">
<cfargument name="id" default="0" />
<cfset local.res = {} />
<cfset local.res.id = arguments.id />
<cfreturn representationOf(local.res) />
</cffunction>
<cffunction name="put">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
<cffunction name="post">
<cfargument name="id" />
<cfreturn representationOf(arguments).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,17 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/upload">
<cffunction name="post">
<cfargument name="img" />
<cfset var local = structNew() />
<!--- accept the upload --->
<cffile action="upload" destination="#getTempDirectory()#" filefield="img" result="local.r" />
<!--- delete the file --->
<cffile action="delete" file="#local.r.serverdirectory#/#local.r.serverfile#" />
<cfreturn representationOf( local.r ).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,22 @@
<cfcomponent extends="taffy.core.nativeJsonSerializer">
<cfproperty name="dependency1" />
<cffunction name="getAsJSON" output="false"
taffy_mime="text/json"
taffy_default="true"
hint="serializes data as JSON">
<cfreturn super.getAsJson() />
</cffunction>
<cffunction name="getAsXML" output="false" taffy:mime="text/xml">
<cfreturn "FAIL FAIL FAIL" />
</cffunction>
<cffunction name="setDependency2">
<cfargument name="dependency2" />
<cfset this.dependency2 = arguments.dependency2 />
</cffunction>
</cfcomponent>
+1
View File
@@ -0,0 +1 @@
<cfcomponent></cfcomponent>
+1
View File
@@ -0,0 +1 @@
<cfcomponent></cfcomponent>
@@ -0,0 +1,7 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/throwException">
<cffunction name="get">
<cfthrow message="this is the exception message." detail="this is the exception detail." />
</cffunction>
</cfcomponent>
@@ -0,0 +1,7 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/uriWithForwardSlash{,},uriAliasWithoutFowardSlash">
<cffunction name="get">
<cfreturn noData() />
</cffunction>
</cfcomponent>
+7
View File
@@ -0,0 +1,7 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo/towel">
<cffunction name="get">
<cfreturn representationOf("don't panic!").withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,7 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="uriWithoutForwardSlash">
<cffunction name="get">
<cfreturn noData() />
</cffunction>
</cfcomponent>