<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.hostek.com/index.php?action=history&amp;feed=atom&amp;title=Lucee_RESTful_Webservice_Tutorial</id>
		<title>Lucee RESTful Webservice Tutorial - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.hostek.com/index.php?action=history&amp;feed=atom&amp;title=Lucee_RESTful_Webservice_Tutorial"/>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=Lucee_RESTful_Webservice_Tutorial&amp;action=history"/>
		<updated>2026-04-15T03:05:10Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=Lucee_RESTful_Webservice_Tutorial&amp;diff=2766&amp;oldid=prev</id>
		<title>Davidd: Created page with &quot;This tutorial will go over the steps for setting up a RESTful webservice using Lucee.  ==Overview==  All rest requests use one of the following special path formats:  '''/rest...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=Lucee_RESTful_Webservice_Tutorial&amp;diff=2766&amp;oldid=prev"/>
				<updated>2016-01-21T16:58:43Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;This tutorial will go over the steps for setting up a RESTful webservice using Lucee.  ==Overview==  All rest requests use one of the following special path formats:  &amp;#039;&amp;#039;&amp;#039;/rest...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This tutorial will go over the steps for setting up a RESTful webservice using Lucee.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
All rest requests use one of the following special path formats:&lt;br /&gt;
 '''/rest/APPLICATION/COMPONENT'''&lt;br /&gt;
 '''/rest/APPLICATION/COMPONENT/FUNCTION'''&lt;br /&gt;
&lt;br /&gt;
For the '''Default''' rest application, the following mappings are used.  The default rest application is assigned within the '''Lucee Web Administrator''':&lt;br /&gt;
 '''/rest/COMPONENT'''&lt;br /&gt;
 '''/rest/COMPONENT/FUNCTION'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''APPLICATION:''' The virtual path assigned to the application in the '''Lucee Web Administrator'''.&lt;br /&gt;
* '''COMPONENT:''' The '''name''' of the cfcomponent or the '''restpath''' of the component if one is provided.&lt;br /&gt;
* '''FUNCTION:''' The '''restpath''' of the cffunction if one is provided.&lt;br /&gt;
&lt;br /&gt;
For functions that do not have a '''restpath''', the specific function executed depends on the '''http verb'''(I.E. get,put,post,delete) matching the '''httpMethod''' property of the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create webservice files==&lt;br /&gt;
&lt;br /&gt;
The webservice files should be added to a sub-folder within your site.  The webservice will be comprised of a group of '''.cfc''' files with the '''rest''' parameter on the '''cfcomponent''' tag set to '''true'''.  You can also use the '''restpath''' parameter to specify the path that should be used for each component if you do not want to use the default of the component name.  Each method also accepts a '''restpath''' parameter if you wish the method to use a sub-path under the component.  Here is an example service:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;cfcomponent rest=&amp;quot;true&amp;quot; restpath=&amp;quot;/restexample&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;cffunction name=&amp;quot;greeting&amp;quot; access=&amp;quot;remote&amp;quot; returnType=&amp;quot;string&amp;quot; httpMethod=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;cfreturn &amp;quot;{ &amp;quot;&amp;quot;Lucee&amp;quot;&amp;quot;: &amp;quot;&amp;quot;I'm home!&amp;quot;&amp;quot; }&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;/cffunction&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/cfcomponent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add webservice mapping==&lt;br /&gt;
&lt;br /&gt;
* Log into the Lucee Web Administrator&lt;br /&gt;
* Select '''Archives and Resources''' -&amp;gt; '''Rest'''&lt;br /&gt;
* Enter the following details within the '''Create new mapping''' section:&lt;br /&gt;
** '''Virtual:''' The '''APPLICATION''' path that you will use when accessing the rest application.&lt;br /&gt;
** '''Physical:''' The '''site-relative''' path to the directory containing the rest cfc components.&lt;br /&gt;
** '''Default:''' The '''default''' rest application can be accessed without including the a '''APPLICATION''' portion in the url.&lt;br /&gt;
* Click '''save'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add handler mapping==&lt;br /&gt;
&lt;br /&gt;
Since the rest URLs will not end with a normal cfml file extension, we will need to manually tell IIS that we want URLs under the rest path to be sent to Lucee for processing.  This is done by adding a '''handler''' to the '''web.config''' within the site's webroot(/wwwroot).  Below is an example of how we could add a rest mapping for the example component given previously:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
   &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
     &amp;lt;handlers&amp;gt;&lt;br /&gt;
       &amp;lt;add name=&amp;quot;BonCode-Tomcat-REST-Handler-restexample&amp;quot; path=&amp;quot;/rest/restexample/*&amp;quot; verb=&amp;quot;*&amp;quot; type=&amp;quot;BonCodeIIS.BonCodeCallHandler,BonCodeIIS,Version=1.0.0.0,Culture=neutral,PublicKeyToken=ad590a40d40745cf&amp;quot; resourceType=&amp;quot;Unspecified&amp;quot; preCondition=&amp;quot;integratedMode&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/handlers&amp;gt;&lt;br /&gt;
   &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is another example that we would use if we chose the '''Default''' option when adding the rest mapping in the Lucee Web Administrator:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
   &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
     &amp;lt;handlers&amp;gt;&lt;br /&gt;
       &amp;lt;add name=&amp;quot;BonCode-Tomcat-REST-Handler-default&amp;quot; path=&amp;quot;/rest/*&amp;quot; verb=&amp;quot;*&amp;quot; type=&amp;quot;BonCodeIIS.BonCodeCallHandler,BonCodeIIS,Version=1.0.0.0,Culture=neutral,PublicKeyToken=ad590a40d40745cf&amp;quot; resourceType=&amp;quot;Unspecified&amp;quot; preCondition=&amp;quot;integratedMode&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/handlers&amp;gt;&lt;br /&gt;
   &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
 &amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Davidd|Davidd]] ([[User talk:Davidd|talk]]) 10:58, 21 January 2016 (CST)&lt;br /&gt;
&lt;br /&gt;
[[Category:Lucee]]&lt;br /&gt;
[[Category:Railo]]&lt;/div&gt;</summary>
		<author><name>Davidd</name></author>	</entry>

	</feed>