settings for REST in CF Administrator

278 Views Asked by At

I am trying to create a REST API in ColdFusion 10. I have created a coldfusion component with a function inside it.

<cfcomponent rest="true" restpath="restService">
    <cffunction name="sayHello" access="remote" returntype="String" httpmethod="GET">        
          <cfset rest = "Hello World">
          <cfreturn rest>
    </cffunction>
</cfcomponent>

CF Administrator settings

Now I wanted to register my component in CF Administrator, so I have given the path to my cfc[D:/wwwroot/used_adm/cfc/resttest] in Root Path section. I wanted to understand what to give in service mapping http://ipaddressOfMyServer:portNo/rest/{servicemappping}/restService here I couldn’t understand what is {service mapping}? What should I mention for my application? Is it path to cfc again?

Edit: In application.cfc I added the code below to make the CFC rest enable:

<cfset restInitApplication("D:\wwwroot\used_adm\cfc\resttest","test") >

I am using this name "test" as a service mapping in ColdFusion administrator.

Then I tried to hit *http://domainName:portNo/rest/test/restService and getting page not found error.

In application.log I could see this error.

"Error","ajp-bio-8013-exec-1","09/29/21","00:34:43","TestProc","Instance of Component used_adm.cfc.resttest.PostTestReq could not be created.''. The specific sequence of files included or processed is: D:\wwwroot\used_adm\cfc\resttest\postTestReq.cfc, line: 115 " Can you please help me with this?

0

There are 0 best solutions below