Entries Tagged as “Zeus”

my first REST resource

June 18, 2012 / Milan Chandna

  ColdFusion | Zeus

 


check complete tutorial here

<- Previous

Contents

Next ->


 

 

PART-III

Tutorial on REST: First REST Resource(cfc)

 

 

In first part we saw a simple example on REST to start off the things. So moving forward I will give another very simple example and will explain it.

 

 

helloWorld.cfc

<!---code starts--->
<cfcomponent restpath="HelloWorld" httpmethod="post" rest="true">
 <cffunction name="World" access="remote" output="false" returntype="string" httpmethod="get">
  
  <cfreturn "Hello World!">
 </cffunction>
 
 <cffunction name="HiWorld" access="remote" output="false" returntype="string" httpmethod="get" restpath="HiWorld">
  
  <cfreturn "Hi World!">
 </cffunction>
 
</cfcomponent>
<!---code ends--->

 

 

 

helloWorld.cfm

<!---code starts--->
<cfhttp url="http://127.0.0.1:8500/rest/IIT/HelloWorld" method="get" result="res">
</cfhttp>
 
<cfdump var="#res.filecontent#">
 
</br></br>
 
<cfhttp url="http://127.0.0.1:8500/rest/IIT/HelloWorld/HiWorld" method="get" result="res">
</cfhttp>
 
<cfdump var="#res.filecontent#">
<!---code ends--->

 

 

helloWorld.cfc

  1. Every component and every function acts as a REST resource(if you are publishing them). 
  2. A new attribute in cfcomponent 'restpath' OR 'rest' defines if a component can be published as a REST resource. Either of these should be present. 
  3. Attribute 'httpmethod' should be there in cffunction tag or cfcomponent tag. 'httpmethod' in cffunction tag overrides the one in cffcomponent tag. To publish/expose a function as resource, this attribute is necessary. Valid values for this are 'GET', 'POST', 'PUT', 'DELETE', 'OPTION', 'HEAD'. 
  4. Similar to 'httpmethod', 'restpath' can also be used in cffunction tag but it doesn't overrides the value of 'restpath' in cffcomponent tag , instead it appends to it. So if you want to call this function(resource), you need to give both the restpath's in URL. Check helloWorld.cfm's second http call for clearer picture
  5. Keeping other things simple like 'access=remote'(required for REST/WEB services) and 'returntype=string', lets see how can we call this service. 

Note: After writing a cfc(at-least one) in webroot, you need to register the folder(in which that REST cfc is present) as REST application, otherwise you will not be able to call any resource. Please check previous chapter for that.


helloWorld.cfm

  1. Considering that you registered this application with name 'IIT', the URL to access first resource(function HelloWorld) will be: http://127.0.0.1:8500/rest/IIT/HelloWorld
  2. So to access that resource all you need to do is, use cfhttp tag and call this URL. Keep in mind that method in cfhttp tag will match to the httpmethod present in function.
  3. Similarly to call the second Resource in cfc(function HiWorld), the URL will be: http://127.0.0.1:8500/rest/IIT/HelloWorld/HiWorld
  4. To call this from a cfm you need to call this URL using cfhttp tag with httpmethod as get.

 

how the URL works:


Breaking the URL for better understading

  1. http://127.0.0.1:8500/ - protocol//ip:port/
  2. rest/ - Compulsary string to call a REST resource. You can change this 'rest' string in server.xml and restart the server for changes to take effect.
  3. Examples/ - Mapping name you give to register an application using Administrator or restInitApplication method(Check next example for this) .
  4. HelloWorld/ - RestPath to call a resource. This was given as 'restpath' attribute in cfcomponent level.
  5. HiWorld/ - If your function also has a restpath then after giving a restpath for your component you need to give restpath for function also to call that function.

 


check complete tutorial here

<- Previous

Contents

Next ->


 


Registering a REST application in ColdFusion10

June 07, 2012 / Milan Chandna

  ColdFusion | Zeus

 

Register a REST application

  1. To access any REST resource you need to register an application either through admin or using restInitApplication().
  2. Registering REST application is required because ColdFusion scans for all the REST resources present in directory you registered
  3. It is also important for you to know that you CAN NOT repeat 'restpath' for one and more resources. That is why it is a better option to create multiple apps, so that you can repeat the restpath in different applications as per your need
  4. You should also know that change in any resource(REST cfc) of your application will need a refresh in applcation. You can refresh from Administrator or using restInitApplication()

 

Moving ahead I will explain few more concepts about registering an application.
restInitApplication()
Application outside webroot
Default application
Refresh Application
Role of Application.cfc
Update/Delete an application

Read more...

 

Read More


Getting Started with REST in ColdFusion 10

May 29, 2012 / Milan Chandna

  ColdFusion | Zeus

Background: REST services are a kind of web services which use http protocol behind the scenes. Geeks familiar with SOAP based web services must be thinking, Is this really possible (if they don't already know about REST architecture yet)? Yes, REST services uses HTTP architecture to get the work done and same way ColdFusion10 has beautifully used its component(cfc) to publish the REST services and cfhttp tags to consume them. So lets quickly get started with REST.

Read More


Availability of ColdFusion 9 and ColdFusion 8 installers

May 29, 2012 / Rakshith Naresh

  Adobe ColdFusion | Adobe ColdFusion 10 | Announcements | web programming | Zeus

[update: Addresses some concerns that were expressed on availability of 9.0.2 for download on the website]

You must have heard about our plans for ColdFusion 9.0.2 and the non-availability of ColdFusion 9 installers which contain Verity post 31st May here.

Full installers for ColdFusion 9.0.2 will be available for download on the website for everyone. Simply put, ColdFusion 9.0.2 is ColdFusion 9.0.1 minus Verity Plus CHF/Security HF Plus JDK 1.6.029.

Post 31st May, you can still get access to ColdFusion 8 or ColdFusion 9 installers with Verity by reaching out to Adobe support. You need to have a valid support contract purchased prior to 15th May to be able to request this.

 


Adobe ColdFusion 10 is now available!

May 14, 2012 / Rakshith Naresh

  Adobe ColdFusion | Adobe ColdFusion 10 | Adobe ColdFusion Builder 2.0.1 | Announcements | Application Server | ColdFusion | creating a website | productivity | Rapid Application Development | web application | web application development | web programming | Zeus

I am pleased to announce that Adobe ColdFusion 10 is now available. Thanks to the amazing engineers from the Adobe ColdFusion product team for this remarkable release.

ColdFusion 10 now offers built-in support for HTML5 and helps boost performance using Tomcat integration and enhanced caching. With the new hotfix installer and scheduler, ColdFusion 10 Enterprise edition allows enterprise developers to improve productivity, while strengthening authentication and encryption techniques to make websites more secure. HTML5 and REST support helps boost performance and productivity for web and mobile applications development.

With a multitude of enhancements, ColdFusion 10 reduces complex business logic into a few lines of code, dramatically accelerating the development cycle. ColdFusion 10 bring s in the same capability to HTML5 application development to help deliver rich user experiences through web-sockets, video player, geo-tagging and interactive charting. Leveraging an array of built-in features, ColdFusion 10 gives developers the tools to condense enormous tasks into easily manageable projects and rapidly build and deploy scalable Java EE applications to satisfy large-scale business needs in the enterprise.

Pricing and Availability

ColdFusion 10 is available now in three editions. ColdFusion 10 Enterprise Edition is a high-performance solution for delivering multiple websites and applications on one or more servers, or on existing J2EE application server installations starting at an estimated street price of US$8499. ColdFusion 10 Standard is an easy-to-manage configuration for single applications ideal for small to medium-sized businesses and available starting at an estimated street price of US$1499. ColdFusion 10 Developer Edition, a full-featured server for development use only, is available as a no charge download. Low cost upgrade pricing is available to customers with valid licenses of ColdFusion 8 and ColdFusion 9. ColdFusion 10 is immediately available for purchase online from the Adobe Store, directly from Adobe, and through Adobe’s network of partners and resellers. For more information, visit http://www.adobe.com/products/coldfusion-enterprise.html. For a complementary trial, visit https://www.adobe.com/cfusion/tdrc/index.cfm?product=coldfusion.

 

ColdFusion Builder 2.0.1

Along with ColdFusion 10, I am also pleased to announce the availability of ColdFusion Builder 2.0.1 update. ColdFusion Builder 2.0.1 focuses on keeping up-to-date with the changes in ColdFusion 10 along with bug fixes and performance improvements. 

Support for new tags and functionalities of ColdFusion 10
Improved Server manager to work with built-in Tomcat server
Eclipse 3.7 upgrade to leverage the latest functionalities
Visit, http://www.adobe.com/products/coldfusion-builder.html

 

 


Blue Mango Theme Design By Mark Aplet

Super Powered by Mango Blog