Showing posts with label REST. Show all posts
Showing posts with label REST. Show all posts

Thursday, May 24, 2018

CF-4202602 - REST method compile time error says wrong file

Issue: REST method compile time error says wrong file

Steps to Reproduce:
1) unzip CF-4202602.zip (attached to ticket)
2) In CF Admin, create "mymapping" mapping to unzipped app's directory
3) run index.cfm to register REST app
4) run mypage.cfm

Actual Result:

The error occurred in {path}/MyCFC.cfc: line 4

2 : component rest=true restpath="a" {
3 :   remote string function returnVoid(string c restargsource="path") httpmethod="GET" restpath="b/{c}" produces="application/json" {
4 :     o = new mymapping.myOtherCFC();
5 :     return serializeJSON(ARGUMENTS.c == 'c' ? 'c' : '');
6 :   }

Expected Result:

The error occurred in {path}/MyOtherCFC.cfc: line 2

1 : component {
2 :   function f() {compileTime=}
3 : }

Note: If `function f() {compileTime=}` is changed to `compileTime` in MyOtherCFC.cfc, then error shows correct file:

The error occurred in {path}/MyOtherCFC.cfc: line 2

1 : component {
2 :   compileTime
3 : }

Note: If `o = new mymapping.myOtherCFC()` is called from a .cfm (i.e. not during REST call), then error also shows correct file.

Summary: The issue seems to only occur when a CFC *method* throws a compile time error during a *REST call*.

Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202602.

CF-4202597 - per-app mappings don't exist in REST CFCs

Issue: per-app mappings don't exist in REST CFCs

Steps to Reproduce:
1) unzip CF-4202597.zip (attached to ticket)
2) run index.cfm to register REST app
3) run mypage.cfm

Actual Result: coldfusion.xml.rpc.CFCInvocationException - Could not find the ColdFusion component or interface mymapping.myOtherCFC

Expected Result: "c"

4) In CF Admin, create "mymapping" mapping to unzipped app's directory
5) run mypage.cfm

Actual and Expected Result: "c"

Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202597.

Monday, May 21, 2018

CF-4202547 - CF2016 vs Aether wrt custom REST response via cfthrow

Issue: CF2016 vs Aether wrt custom REST response via cfthrow

History: Pre-Aether, cfthrow could be used to send a custom REST response as JSON. In Aether, this fails (returns HTML of error handler page).

Steps to Reproduce:
1) Unzip CF-4202547.zip (attached to ticket)
2) Run index.cfm to register the REST application
3) Run mypage.cfm and compare the output w/ the code comments in mypage.cfm

Actual Result: CF sends cfthrow's custom message as HTML of error handler page

Expected Result: CF sends cfthrow's custom message as JSON

Related URL: Getting Started with RESTful Web Services in ColdFusion

Verified in build 2018.0.01.308605 (PreRelease).
Filed as CF-4202547.
Summary:

Initially:
1) In non-void UDF, restSetResponse() was ignored
2) In void UDF, cfthrow returned custom REST response as HTML of error handler page (instead of JSON)

Both were filed as CF-3546046, but only #2 was fixed (which I've verified in CF2016 Update 1).

#1 was re-filed as CF-4198298.

In Aether Public Beta Update 1, #1 is fixed but #2's fix was reverted/undone/unfixed.

Filed CF-4202547 to re-fix #2.

ColdFusion member functions for XML object management

Prior to ColdFusion 2018, ColdFusion supported the following XML member functions : .elemNew() (equivalent of XmlElemNew ) .childPos(...