问题
Just started looking at some MVC JS framework / library and most of them expect a RESTful API endpoint, which got me thinking... what can I do using CF10 that cannot be done using CF9 + ColdBox RESTful support, and vise versa?
Thank you.
回答1:
Restful webservices is a standard concept and all the implementation eventually adhere to those norms. There are already existing frameworks like Taffy, Powernap and frameworks like ColdBox 3, Mach II which can help create restful services in ColdFusion. And I they do a terrific job in terms of completeness and empowerment offered to the users. The difference much lies in the way they enable it, how do they let you create your services. Some follow convention others configuration with their own DSL etc and somewhat in terms of features they offer.
ColdFusion 10 has native restful webservices support. What it brings to the table is:
- You can use your own understanding of components and extend them as restful webservices
- Based on standard JAX-RS
- Tons of support/ applications available for extending (testing/automation)....
- No implementation biasness, widely available/acceptable
- Better performance
- Better support and doc
- Less configuration
- Application WADL implmented (WSDL like)
- Full JSON/XML support and easily extensible
As you will see most of these are benefits of having it "natively" available to the language rather than a vis a vis comparison of features and that is why we have implemented it. IMO there isn't any comparison at all. I would like to see all frameworks take the advantage of natively available feature and build on top of it.
Thumb rule should be pre CF10 use any one which suits your taste, usecase/ post CF10 release use natively available or any framework which utilizes the same.
Word of caution: Every framework author would be biased towards their own so judge before you take the leap.
p.s. I have implemented Rest support in ColdFusion10 :)
回答2:
As rest cfc would generally just be a wrapper for your model, and if your model was already created with a cf framework like coldbox, you may be better of using the frameworks implementation of a ReSTful webservice .
If you are starting off from scratch, the newly added functionality in CF10 ( and Railo 4) will give you the infrastructure without the overhead of the application framework.
回答3:
Excellent resource: https://github.com/atuttle/CF-REST-Comparison/tree/master/CF10
Requirements / Quirks
- All remote methods must have returnType="..." specified (where ... is the type that will be returned).
- Don't forget restArgSource for
<cfargument/>
tags for URI-token arguments. The default value for restArgSource is body, which will not work if you're trying to get a value from the URI.- Application-specific mappings are not supported. Use server-mappings or the fully-qualified cfc path instead.
- Whenever refreshing services, I always follow this workflow: Delete "exception.log" from the log files screen Refresh REST services Check to see if "exception.log" is back. (If so, read it and address the problem.)
来源:https://stackoverflow.com/questions/10711851/what-can-cf10-restful-api-do-that-coldbox-restful-api-cannot-do-and-vise-versa