restSetResponse

Sets the custom responses.

restSetResponse(response); → returns void

Argument Reference

response struct
Required

A struct that contains the response details.

Examples
Sample code invoking the restSetResponse function

restSetResponse() can only be used on function with a return type of void. It will cause errors if it is used on functions that have any other return type.

<cffunction name='create' httpMethod='POST' produces='application/xml'> 
 <cfargument name='id' type='numeric'> 
 <cfargument name='name' type='String'> 
 <cfset var response={ 
 status=201, 
 content='<customer id='&id&'><name>'&name&'</name>
 </customer>'>, 
 headers={ 
 location='http://localhost:8500/rest/CustomerService/customers/123', 
 } 
 }> 
 <cfset restSetResponse(response)> 
 <cffunction> 

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub