Entries for month: “June 2012”

Elishia Dvorak Joins as ColdFusion Solution Consultant and Product Evangelist

June 22, 2012 / Elishia

  Announcements

Hi Everyone!

I am pleased to be able to make the announcement that I've just rejoined Adobe and the ColdFusion team as the new Solution Consultant and product Evangelist. I'm extremely excited for this opportunity and can't wait to get started. I'll most likely be meeting many of you at any of the upcoming events or customer meetings if I don't know you already. Thank you for the warm welcomes I've received from so many of you already!


Elishia
@elishdvorak

Read More


Outstanding contributions to the ColdFusion 10 and ColdFusion Builder 2.0.1 pre-release

June 19, 2012 / Rakshith Naresh

  Adobe ColdFusion 10 | Adobe ColdFusion Builder 2.0.1 | Rapid Application Development | web application development | web programming | Adobe ColdFusion | CFBuilder | Announcements

We have had some valuable contributions to the ColdFusion 10 and ColdFusion Builder 2.0.1 pre-release. The participants showed a lot of interest in ensuring that they give maximum feedback to the product team. This just goes on to the show passion that you have for the product. Thanks to each and everyone one of you who participated in the pre-release program for ColdFusion 10. The product team values every contribution that was made. We will look forward to your contributions as we move towards building the next major version of ColdFusion.

Now to reward the top contributors of the pre-release.The top three contributors each will get a license for ColdFusion 10 Enteprise. The other two contributors following the three contributors will get a license for ColdFusion Builder.

Both the pre-release forum participation and the bugs filed were considered to identify the top contributions.

Here are the top three contributors who will get a license for ColdFusion 10 Enterprise.

Adam Cameron, Aaron Neff and Raymond Camden

The other two contributors who will get a license for ColdFusion Builder are:

David McGuigan and Charlie Arehart

Congratulations to all of you! 

And thanks once again to everyone who took time to participate in the pre-release. 

 

 

 

 

 

 

 


CF html to pdf service - consume from node.js using rest api

June 18, 2012 / Milan Chandna


Convert a html document to PDF using ColdFusion <cfdocument> and REST power.

If you are not sure about how to start with REST, you can read my blogs here.
If you see how to consume this CFC from node.js, please read my blog here

So let's write a CFC which will be exposed as pdf service using REST api.


Explanation:
Over here we have exposed a ColdFusion component as a REST resource - pdf, which will accept an html body and will return a pdf file in binary.

In the only function present, I am accepting POST request and will produce the content in "application/xml" format. POST request will be accepted because my httpmethod attribute in the function is POST and produces attribute is "application/xml" so it will produce xml content.

There is a point to note that even though I am producing xml content but still the produced string will not contain any xml tags. That is because ColdFusion only serializes the return variable in xml/json if it is complex variable like an Array, a Struct, a CFC etc.. As we are producing a binary which is a simple data type, so it will not be serialized rather will be returned as it is.

For consuming the data I am looking for argument in body of the request. Generally you will find the restargsource attribute present in <cfargument> tag to tell you where to look for the data. But if it's absent ColdFusion looks for the argument in the body of request.

Inside the function I am using <cfdocument> tag to convert the HTML body passed from client into PDF file. This PDF file will be saved in a variable name "pdffile" in binary format. And then returning this pdffile as it is in binary format back to the client.

Client side can be written in any language but here I will write an exmaple in ColdFusion itself.

All we need to do in client side is to call this service with POST http request and pass the HTML content in the body of the request.
..
In this example I am reading a html file from local directory and passing it's content to the service we just exposed.
And finally we are saving the result we have got back to sample.pdf

If you see how to consume this CFC from node.js, please read my blog here

That's it. We are done.

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 ->


 


Adobe ColdFusion Mobile and HTML5 Survey

June 14, 2012 / Rakshith Naresh

  Rapid Application Development | creating a website | web application security | productivity | scripting language | Adobe ColdFusion | Announcements | HTML5

I have posted the Adobe ColdFusion Mobile and HTML5 survey here. Please spare a few minutes to help Adobe take the right steps to build the future of the product that you love - Adobe ColdFusion!


Blue Mango Theme Design By Mark Aplet

Super Powered by Mango Blog