{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

ColdFusion Builder 2 Extensions - Understanding Callback Commands

CallBack commands in ColdFusion Builder 2 Extensions make it possible to

1) Get data other than the context in which extension menu was clicked

2) Get additional data/info. required to generate code/any other task while in execution of handler CFM

What are Callback Commands?

Callback commands allows handler CFMs in extensions to communicate back to ColdFusion Builder and execute supported Commands. This communication is done using an HTTP call to a specific Callback URL(specified in ideeventinfo xml). Most importantly this communication takes place while handler CFMs are still in execution. This means using callback commands handler CFMs can

1) Request more information for ColdFusion Builder - Using get commands

2) Request File Operations - Using file commands

3) Get user Input - creating SWT dialog through well formed XML

Following is the List of Supported Commands

  • Get Servers (getservers)
  • Get Datasources (getdatasources)
  • Get Tables (gettables)
  • Get Table (gettable)
  • Get Function and Variables(getfunctionsandvariables)
  • Open File (openfile) - supports placing cursor at a given line number
  • Insert text into Editor (inserttext) - supports to overwrite/wrap selection with insertion text
  • Search file (searchfile)
  • Refresh File, Folder, Project(refreshfile, refreshfolder, refreshproject)
  • Also extensions can create input dialog - by sending xml in similar way as to create dialog through XML response from CFM handlers

What is Callback URL?

Callback URL is the URL used to send your callback commands from CFMs back to ColdFusion Builder. With every ideeventinfo param sent from ColdFusion Builder to handlers, a callback URL is sent, packed inside <ide> tag. Extensions can use this URL to send callback commands to ColdFusion Builder. Syntax for creating Callback Commands is same as Commands in ColdFusion Builder 1 Extensions.

Steps to Use Callback Commands

  • Get callback URL from ideeventinfo XML

  • Create XML to send command to ColdFusion Builder

  • Execute callback command and get response

I have created a simple Demo extension to show how callback commands work. Demo extension includes example for most of the commands used as callback command.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks