Answer triggers // slash at the beginning - Taffy - ColdFusion

I installed my first REST API and I am new to using the Taffy platform.

I have a website that is working on ColdFusion 10, IIS and uses ColdBox. I have an example hello world in a directory. I get //two slashes in the response. Here is an example response:

//["hello","world"] 

My hello.cfc looks like this:

component extends="taffy.core.resource" taffy_uri="/hello" {

    function get(){
        return representationOf(['hello','world']);
    }

}

My application.cfc is as follows:

<cfcomponent extends="taffy.core.api">
    <cfscript>

        this.name = hash(getCurrentTemplatePath());
        this.mappings["/resources"] = listDeleteAt(cgi.script_name, listLen(cgi.script_name, "/"), "/") & "/resources";

        variables.framework = {};
        variables.framework.reloadKey = "reload";
        variables.framework.reloadPassword = "test";
        variables.framework.serializer = "taffy.core.nativeJsonSerializer";
        variables.framework.returnExceptionsAsJson = true;

        function onApplicationStart(){
            return super.onApplicationStart();
        }

        function onRequestStart(TARGETPATH){
            // reload app to make any envoirnmental changes
            if(structkeyexists(url,'reloadApp')){
                applicationStop();
                location('index.cfm');
            }
            // load Taffy onRequestStart before our stuff
            super.onRequestStart();

            if (request.taffyReloaded) {
                // reload ORM as well
                ORMReload();
            }
        }

        function onTaffyRequest(verb, cfc, requestArguments, mimeExt){
            return true;
        }
        function onError(Exception)
        {
            writeDump(Exception);
            abort;
        }
    </cfscript>
</cfcomponent>

Can someone tell me where I am going wrong? Is this related to using ColdBox?

+4
source share
1 answer

ColdFusion . JSON . ColdFusion 10, . ( , ​​ ColdFusion 9.) -, JSON JSON . , . .

Raymond Camden - JSON jQuery jQueryUI

. , secureJSON secureJSONPrefix Application.cfc. . - .

secureJSON - , , , ColdFusion JSON- .

- JSON " " > "" ( "" ). cffunction.

secureJSONPrefix - , , ColdFusion JSON-, , secureJSON .

- JSON " " > "" ( // JavaScript).

+7

Source: https://habr.com/ru/post/1623584/


All Articles