Skip to main content
Participating Frequently
October 8, 2010
Question

How to map remote cfc alias differently than their directory structure

  • October 8, 2010
  • 3 replies
  • 1479 views

It seems that the remote class alias on a cfc has to be its directory structure location in an application. The problem with this is that if I want to have a remote actionscript class map to the same component in multiple different coldfusion apps, I can't. I want to have:

AS3

[Remote Alias=("com.whatever.whatever")]

    This topic has been closed for replies.

    3 replies

    fosriasAuthor
    Participating Frequently
    October 8, 2010

    Having researched this more, it appears that what I am trying to accomplish cannot be done on coldfusion, which by the way , seems astounding to me.

    Basically, if you want to use a different alias on a cfc than its complete path structure, you have to create a mapping for whatever it starts with.

    So,

    component alias="com.whatever.whatever" {}

    just needs a mapping for 'com'. No problem you say, I will just create an application specific mapping and then I can reuse my class in that application.

    WRONG!!!!

    Remote calls don't access application specific mappings since they don't access the application. Your hosed.

    So, what do you do? Well, of course you go to your Coldfusion admin and create the mapping there. Wow, my broken remote works. But wait a minute, I am still screwed because now, my mapping for 'com' goes to only one place which is the same as if I had used the fully qualified path as the alias in the first place. I can't create an application copy of it with the alias, which makes everything simple.

    Unless someone knows a workaround, this is a joke. No reusability of AS3 classes without an alias nightmare.

    Participating Frequently
    October 10, 2010

    I am working on a Flex project right now, where the remote alias specified in Flex does not match the path structure in CF. However, I set the alias on the CFC to match what is specified in Flex and it works fine.

    fosriasAuthor
    Participating Frequently
    October 10, 2010

    I found that also when loading data to the Flex app because all the action is done by the flex deserializer which knows what to do with the alias. However, where it breaks down is when I was trying to save or update the record on the coldfusion server.

    Are you doing CRUD and finding this or only R?

    Community Expert
    October 8, 2010

    If it's in different CF apps, it's not the same component. It's a copy of the same component. You could place the component in a location accessible by both applications, essentially giving it its own application.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    Dave Watts, Eidolon LLC
    Participating Frequently
    October 8, 2010

    You can specify the alias attribute on your CFC and make sure it matches the alias you use in your Flex application.

    fosriasAuthor
    Participating Frequently
    October 8, 2010

    U r fast. Screwed up my posting and you answered.

    I want

    AS3

    [RemoteClass (alias="com.whatever.whatever)]

    CF

    component alias="com.whatever.whatever"

                     table="my_table"

    {

    }

    And then be able to use a copy of the component in any application. The application would have a datasource with the corresponding table and the service would find the component in the application it resides in and use it for mapping remote calls.

    What I find is that CF barks it can't find the remote class unless I do:

    AS3

    [RemoteClass (alias="CFSpecificApp.com.whatever.whatever)]

    CF

    component alias="CFSpecificApp.com.whatever.whatever"

                     table="my_table"

    {

    }

    where CFSpecificApp.com.whatever.whatever is the exact path to the cfc.

    Talk about handcuffs. Obviously your flex app is a nightmare maintain this way, since you would have to edit your class all the time.

    Seems to be some kind of path setup issue in the CF app.

    Further ideas?