I'm building a RESTful API with ColdFusion 11. Today I noticed there are a ton of warnings being logged to the coldfusion-error log file. For example:
Mar 04, 2015 8:09:52 AM com.sun.jersey.spi.inject.Errors processErrorMessages
WARNING: The following warnings have been detected with resource and/or provider classes:
WARNING: A HTTP GET method, public void api.Country.GetCountry() throws coldfusion.xml.rpc.CFCInvocationException, MUST return a non-void type.
WARNING: A HTTP GET method, public void api.Log.GetLog(java.lang.Double) throws coldfusion.xml.rpc.CFCInvocationException, MUST return a non-void type.
WARNING: A HTTP GET method, public void api.Logout.LogoutUser(java.lang.Double) throws coldfusion.xml.rpc.CFCInvocationException, MUST return a non-void type.
Here is one of my API endpoint functions:
<cfcomponent restpath="country" rest="true" output="false" extends="cfc.data">
<cffunction name="getCountry" access="remote" output="false" httpmethod="get" returntype="void">
<cfset LOCAL.countryData = getCountryData()>
<cfset LOCAL.restResponse = StructNew()>
<cfset restResponse = REQUEST.apiObj.response(200, countryData)>
<cfset restSetResponse(restResponse)>
</cffunction>
</cfcomponent>
My understanding is that returntype=void is a MUST in order to use restSetResponse(). This code works great, but the warnings in the log file don't make sense to me.
Am I doing something wrong?
Or is this some sort of "gap" where logging isn't factoring in REST services/functionality?
Is it possible to disable warning messages from getting logged?
Thank you!
Brian White