Arun
Arun

Reputation: 215

How to do coldfusion mapping in application level

I have below directory structure -

I have created one service named (userService.cfc) which have the below script

import services.userService;

component accessors="true" alias="services.userService"
{
    remote userService function init()
    {
        return This;
    }

    remote any function getUser()
{
   var userObj = new cfc.sessionUser();  

          return userObj;        
}
}

If i call this service from inside the application, this is working fine

Again if i am trying to call it from outside the application, need to change this statement as below and again it is working fine.

 import rootFolderName.services.userService;

    component accessors="true" alias="rootFolderName.services.userService"
    {
        remote userServicefunction init()
        {
            return This;
        }

            remote any function getUser()
        {
             var userObj = new rootFolderName.cfc.sessionUser();  

                return userObj;        
         }
    }

But If i put this code on another rootFolder suppose on "rootFolderName1" name i have to changed all the place where i used the rootFolderName. I got one solution by CFADMIN folder mapping on server level. but i want it on application level.

Can we configure it on Application.cfc? I have used Mappings also but that is not working.

Actually i have two separate application one flex application which is trying to access the second application services remotely. second application have cfc and sevices.

Please help on this.

Upvotes: 2

Views: 584

Answers (1)

Steve -Cutter- Blades
Steve -Cutter- Blades

Reputation: 5422

I would review Ben Nadel's post on the use of ExpandPath() in writing app level CF mappings

http://www.bennadel.com/blog/2519-ExpandPath-Works-With-ColdFusion-s-Per-Application-Mappings.htm

Upvotes: 3

Related Questions