<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: new rest2 webapp in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8715#M2908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd like to add, that I clearly see value in having a generic REST API for remote interactions with the engine. From what I heard, the current REST API seems to be a bit too tailored to the three web applications shipped with Activiti.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we collect a list of changes that need to be made in terms of URL patterns and representations in order to make the REST API more generic?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on this set of changes, we could decide on one the following options:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Do the changes in the existing REST module, which would in turn require to adapt all our webapps. However, we are already quite busy with implementing the last features for the GA release in the webapps. Hence, there is a high risk of breaking existing features and not completing planned features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. If there are too many changes, a second REST module may avoid those risks. The existing REST module could then be marked as deprecated. But, I don't think that we will be able to switch all webapps to use a different REST API until the GA release, as there is an even higher risk of breaking existing features and not completing planned features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Nov 2010 10:01:54 GMT</pubDate>
    <dc:creator>falko_menge</dc:creator>
    <dc:date>2010-11-02T10:01:54Z</dc:date>
    <item>
      <title>new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8705#M2898</link>
      <description>Huh, what is the rest2 webapp?we're trying out a new rest style.&amp;nbsp; one that gives us better control.&amp;nbsp; we're not that happy with the indirect steps of the template rendering.&amp;nbsp; lot of things need to be right in order for it to work and we believe it could be done simpler.so we're now trying out a simpl</description>
      <pubDate>Fri, 29 Oct 2010 13:42:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8705#M2898</guid>
      <dc:creator>tombaeyens</dc:creator>
      <dc:date>2010-10-29T13:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8706#M2899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are 2 REST approaches we consider instead of using ftl-templates:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Using the existing spring surf webscripts, but replace the freemarker-templates with rendering done by a JSONObject, based on the model created in the existing ActivitiWebScript implementation which use the API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pros:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Leveraging the rest-posibilities built in into spring surf to map url’s to java code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Since we populate JSONObjects based on activiti domain model, it’s more easy to see where they are used (a simple Cmd+G will show where data is used), instead of templates which contain only text-references to these properties.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Using existing WebScript implementations with some tweaks here and there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• JSONObject generates valid JSON and escapes accordingly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cons:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Dependency on spring-surf just to use rest-functionality&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Create a custom REST servlet which handles the rest calls by delegating to the appropriate handlers, using JSONObject to create valid JSON output and stream it back to client. Large part of existing Webscript java code can be reused which calls activiti API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pros:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• No dependency at all, just plain old servlet spec&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Same advantages mentioned in 1) thanks to JSONObject (escaping + using domain model)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cons:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• Creating parsing/delegating mechanism from scratch, which can takes a couple of days of development&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;• &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;________________________________________________________________________________________&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another thing we want to tackle is splitting up the REST-api in the folowing parts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) UI-independent REST, containing calls that map right onto the activiti java API, eg: Get list of deployments.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) A single rest api for each of the UI’s we have (explorer, cycle, probe,…), since some rest methods are created for those. Examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;• Get tasks summary. Returns number of tasks for all groups the user belongs to, assigned to him/her and unnasigned. This call is absolutely needed ion explorer to prevent calling a bunch of seperate rest-methods that contain too much data anyway. This is a valid usecase from a task/user oriented point of view, but isn’t really generic engine api stuff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;• Cycle-related rest calls, which also use cycle-related services/data which isn’t nessesairy always deployed alongside the activiti-rest-webapp.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The webapps (explorer, probe, cycle) will expose extra REST-services (if needed) in their own war. The spring surf services used in the components will use 2 rest-endpoints: the core api-rest and their own custom REST-services. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Only downside of this is that if other apps want to use the specific REST-services exposed this way by UI’s is that the UI webapp should be deployed to make use of the included rest-services. Offcourse, we can create seperate war for the UI-secific REST (eg. activiti-wabapp-cycle-rest), but we want to avoid a million war’s being deployed &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the custom REST is included in the cycle/explorer/probe the 'dependency on spring-surf' stated in the 'cons' of the first solution proposed in 'replace freemarker templates' are a non-issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;___________________________________________________________&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We want this change to be implemented in 3-4 months so we can provide the same backward-compatibility/stability guarantees on core rest api, as we do on the engine API. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To facillitate this, unit-tests should be added to test the rest api to signal that any engine refactorings may have broken rest API behaviour.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Major changes to rest-api after it’s marked “stable” (now it’s still marked as experimental) will use a deprecation-strategy. Depending whether or not the (deprecated) old rest service calls still work in future versions, they can be removed after being marked as deprecated after a certain amount of time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Quite some material to read through above, some good lecture for a rainy sunday afternoon &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt; Please share any remarks, thoughts, suggestions or other solutions!!&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Oct 2010 17:27:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8706#M2899</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-10-29T17:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8707#M2900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe, &lt;/SPAN&gt;&lt;A href="http://www.restlet.org/" rel="nofollow noopener noreferrer"&gt;Restlet&lt;/A&gt;&lt;SPAN&gt; is worth a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's API is much more suitable for REST than the Servlet API and we already have the dependency in Activiti, as we are using it as a REST client in Cycle. In a past project, I made some good experiences with it's server capabilities and it could save us the effort of building an own parsing/delegating mechanism on top of the old Servlet API.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Oct 2010 11:11:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8707#M2900</guid>
      <dc:creator>falko_menge</dc:creator>
      <dc:date>2010-10-30T11:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8708#M2901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Falko,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Restlet is also indeed a valid option. Since it supports using the JAX-RS annotations it's also future-proof for JEE6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Apache CXF also implements this standard, I'll have a look at that as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for the feedback, keep it coming &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Oct 2010 08:33:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8708#M2901</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-10-31T08:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8709#M2902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;since I've been working with spring-surf and freemarker templates for a while now, implementing the activiti-cycle webapp, I thought I'd quickly share my thoughts on this discussion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Data transformation calls for a template engine&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that it would be nice to have IDE support for refactorings, i.e. warnings when you rename a class or remove an attribute. However, transforming data is cumbersome in java. Annotations can be a solution, but aren't always flexible enough. So you need to define some kind of mappings, whether these are XML files, freemarker templates like in spring-surf, or custom java code like i.e. in Restlet 2.0. Also, JSON isn't the only format we need to support, we also stream binary content or process plain HTML forms that are posted to the server. Which ever framework you choose, it should support these things in an easy way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) "Don't re-invent the wheel"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Spring-surf currently takes care of a whole bunch of things you didn't mention in this discussion so far. Apart from doing data transformation with freeemarker templates, it also handles parameters, dispatches the content-type of HTTP requests and chooses the content representation accordingly, it takes care of session handling, authentication and authorization and provides the basic HTML scaffold for the web applications, which are mainly written in JavaScript/ YUI. Re-implementing all this with the "plain old servlet spec" would mean to be writing a whole new framework.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) "Innovation is seldom hindered by platform"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that a thorough review of the existing REST API is a good idea and it is essential to make it stable and consistent. However, the existing infrastructure is not the reason this isn't the case yet. The REST API simply grew according to UI requirements. Now that we have a fairly stable java API and know more about what we need in the UIs, we can concentrate on making the existing REST API stable and consistent. Spring-surf certainly won't get in the way!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nils&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Nov 2010 13:16:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8709#M2902</guid>
      <dc:creator>nils1</dc:creator>
      <dc:date>2010-11-01T13:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8710#M2903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nils, thanks for sharing your thoughts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are right, there is more that meets the eye in the spring-surf REST running right now (authentication, dispatching, parameter parsing, …). Can I conclude that you would suggest to keep the spring-surf setup and try to use JSONObjects instead of the *.ftl to have a bit more safety, leaving all the other stuff (like streaming bytes instead of JSON) as is?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A quick note about your thought nr.3, the issue about reorganizing rest API methods to separate parts is indeed not related to the technology we use. Maybe I wasn't so clear in first my comment, but they are two separate issues.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Nov 2010 13:52:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8710#M2903</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-11-01T13:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8711#M2904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My thoughts on changing the technology the REST API is based upon:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Separation of logic and presentation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As Nils says, there needs to be some layer between the application logic and the view the user gets - the question should be: Is FTL the best templating/markup language for the job?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Target audience&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Who are we expecting to be doing API modifications, customisations and extensions? Are they Java developers? UI developers? Will the majority of them come from an Alfresco background (with pre-existing knowledge of Spring Surf)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) If it ain't broke…&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As I understand it, from previous discussions with Tom, one of the main issues is that when bits of the core change, it can be tricky getting that bubbled up to the REST layer and into the UI - however as we're reach a release candidate, are things not going to become more stable, removing a lot of the need to be able to refactor the code easily? Minor changes will become easier with time as developers on both side understand the other better. Having just had the code freeze for RC1, is this the time for a major re-architecture?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Consistency&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There's something to be said for using the same framework as the other webapps and keeping things consistant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Nov 2010 15:45:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8711#M2904</guid>
      <dc:creator>davidcognite</dc:creator>
      <dc:date>2010-11-01T15:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8712#M2905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Frederik:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;JSON objects might seem like a nice solution if you only want to transform your data to JSON. However, a REST API should be able to respond with different content-types, according to the request.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what the best solution is, but I don't think JSON objects are the solution. As David said, we'll need some layer between the application logic and the view. I can add that I found it easy to work with spring-surf and freemarker. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe a separate REST module to evaluate whether an alternative technology yields better results isn't a bad idea. I would suggest to have a look at how Restlet 2.0 deals with data transformation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nils&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Nov 2010 17:30:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8712#M2905</guid>
      <dc:creator>nils1</dc:creator>
      <dc:date>2010-11-01T17:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8713#M2906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nils, indeed. Actually, I meant using a custom "renderer" on top of the existing WebScripts' returned model hashmap, using JSONObjects. This way, any other format is still possible, only the actual rendering of JSON is done in java-code instead of freemarker which gives us the desired "safety".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This week I'll digg a bit deeper into the alternatives like the JAX-RS api (using restlet).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Nov 2010 17:55:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8713#M2906</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-11-01T17:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8714#M2907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a very quick opinion on this from me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think it is a good idea to make a big change in that area now, where we already have a lot of stuff and somehow understood how the current technology works. We already have to provide own stuff around myBatis, what e.g. Hibernate could do out of the box. I don't want to do the same in the are of REST. And I think it is still a good idea, that the web apps use the same technology then REST, less to know to understand the code. I agree with David, that changes in that API gets less frequent every day. IT's a bit annoying, yes. But it's the same on the DB level, where I have to change one attribute in several mapping SQL's and SQL scripts. But these 5 minutes here and there aren't worth the effort we need for such a refactoring I think&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About splitting the REST-webapps: I don't see a big advantage here (unless we really want to aim for seperate installations of Cycle and Engine, which was blocked when I brought it up for database. Why for REST then?). And I see more Maven projects and especially much more complicated class loading. Currently just putting some stuff in the Tomcat lib directory already is a bit hacky in terms of classloading (and causes some trouble as for Cycle we would have to add more jars there, which we avoid by putting cycle in the REST/WEB-INF/Lib folder, where it truly belongs). The more web-apps, the more complicated class loading.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bernd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Nov 2010 07:10:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8714#M2907</guid>
      <dc:creator>bernd_ruecker</dc:creator>
      <dc:date>2010-11-02T07:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8715#M2908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd like to add, that I clearly see value in having a generic REST API for remote interactions with the engine. From what I heard, the current REST API seems to be a bit too tailored to the three web applications shipped with Activiti.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we collect a list of changes that need to be made in terms of URL patterns and representations in order to make the REST API more generic?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on this set of changes, we could decide on one the following options:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Do the changes in the existing REST module, which would in turn require to adapt all our webapps. However, we are already quite busy with implementing the last features for the GA release in the webapps. Hence, there is a high risk of breaking existing features and not completing planned features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. If there are too many changes, a second REST module may avoid those risks. The existing REST module could then be marked as deprecated. But, I don't think that we will be able to switch all webapps to use a different REST API until the GA release, as there is an even higher risk of breaking existing features and not completing planned features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Nov 2010 10:01:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8715#M2908</guid>
      <dc:creator>falko_menge</dc:creator>
      <dc:date>2010-11-02T10:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8716#M2909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As I understood, the work on the new REST API (2) is planned for the next three to four months. As long as it doesn't break the existing web apps, I don't see a reason not to do it. I won't really be able to dedicate time to it myself, but I'm interested in the outcome. Once the API is there, we'll be able to judge whether we can easily switch the webapps to it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We should just try to keep effort and actual benefits in balance. If it takes too much time to switch the webapps to the new API, the time might be better invested in making the existing API stable and consistent. But as long as you take the existing one as a starting point and make sure the new API provides everything the webapps need, the transition shouldn't be too difficult.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nils&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Nov 2010 10:30:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8716#M2909</guid>
      <dc:creator>nils1</dc:creator>
      <dc:date>2010-11-02T10:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8717#M2910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Bernd: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think i'll ditch the "roll our own" solution based on the feedback received &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;About the extra modules. The custom cycle rest services would be exposed in the activiti-webapp-cycle itself, so no extra jars/wars are needed. Since the UI (cycle, explorer, probe) will evolve much more than the engine API, it would be a bit harder to mark the whole REST (including custom UI stuff) as stable and guarentee the same level of stability and backwards-compatibility. A split will address this issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@Nils, Falko:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's indeed a bit risky to do a whole architecture change right before a GA release. Anyway, first thing I will try is to create unit/integration tests for the existing REST-api, testing within webapp container to make it more stable.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Nov 2010 14:28:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8717#M2910</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-11-02T14:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8718#M2911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Bernd: the motivation to split up the rest calls between UI specific and generic rest calls lies in our experience on how we create the rest calls now.&amp;nbsp; Most of the view related rest requests are just based on how the needs for the current UI.&amp;nbsp; Those calls group a number of data fetching api calls and build a data structure that contains all the data to render a particular screen.&amp;nbsp; Those type of UI related calls are not generic, but UI specific.&amp;nbsp;&amp;nbsp;&amp;nbsp; On the other hand, most of the action rest requests map 1-1 to api service calls.&amp;nbsp; Those requests are more generic and can be reused by multiple applications.&amp;nbsp; That's the motivation to split up the generic, API based rest requests from the specific UI based rest requests.&amp;nbsp; We think it's best to include the UI specific rest requests as part of the specific .war&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Nov 2010 20:52:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8718#M2911</guid>
      <dc:creator>tombaeyens</dc:creator>
      <dc:date>2010-11-02T20:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8719#M2912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We're sticking with the Spring-surf Webscript, using JSONObject instead of the *.ftl's for rendering JSON responses.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've implemented a solution for this (which I'll checkin in a few minutes on trunk). It's already plugged-in into the webscript-context, but as long as the *.ftl template is available, the FreemarkerTemplateProcessor will be used. Once we are confident about the solution, the ftl's are removed and JSONObject stuff kicks in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Curently, all rest-calls (identity, engine, process, repository, task) have new implementation on trunk, except for the api.cycle.* calls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A quick overview of the implementation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;* Plugged in a TemplateProcessor into the webscript context, which is registered automatically when context starts/reloads:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;lt;bean id="jsonObjectTemplateProcessor" class="org.activiti.rest.builder.JSONTemplateProcessor"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="templateProcessorRegistry" ref="webscripts.web.templateregistry" /&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="defaultEncoding" value="UTF-8" /&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="templateNamePrefix" value="org/activiti/rest/api/" /&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="indentFactor" value="2" /&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/bean&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;* For each webscript we want to have rendering for using JSONObject, we add a bean in spring-context, eg.&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;lt;bean id="org.activiti.rest.api.repository.deployments.get.json.builder" &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class="org.activiti.rest.builder.repository.DeploymentsObjectBuilder"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="templateName" value="repository/deployments.get.json" /&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/bean&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;The bean implements interface org.activiti.rest.builder.JSONObjectBuilder, which is picked up automatically by our TemplateProcessor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;public interface JSONObjectBuilder {&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; String getTemplateName();&lt;BR /&gt;&amp;nbsp; JSONObject createJsonObject(Object model) throws JSONException;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;}&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;* When for example webscript "org/activiti/rest/api/repository/deployments.get" is called, in format JSON, out TemplateProcessor will receive a request to render template 'org/activiti/rest/api/repository/deployments.get'. Since we have a JSONObjectBuilder regsitered with templateName "repository/deployments.get.json" (also note the 'templateNamePrefix' is used when matchin templates) , this bean will be called to create a JSONObject, which is written to the response by the TemplateProcessor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;private DeploymentJSONConverter converter = new DeploymentJSONConverter();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; @Override&lt;BR /&gt;&amp;nbsp; @SuppressWarnings("unchecked")&lt;BR /&gt;&amp;nbsp; public JSONObject createJsonObject(Object modelObject) throws JSONException {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONObject result = new JSONObject();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Map&amp;lt;String, Object&amp;gt; model = getModelAsMap(modelObject);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;Deployment&amp;gt; deployments = (List&amp;lt;Deployment&amp;gt;) model.get("deployments");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONUtil.putPagingInfo(result, model);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONArray deploymentsArray = JSONUtil.putNewArray(result, "data");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (deployments != null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (Deployment deployment : deployments) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deploymentsArray.put(converter.getJSONObject(deployment));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return result;&lt;BR /&gt;&amp;nbsp; }&lt;/CODE&gt;&lt;CODE&gt;public class DeploymentJSONConverter implements JSONConverter&amp;lt;Deployment&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; public JSONObject getJSONObject(Deployment deployment) throws JSONException {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONObject json = new JSONObject();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONUtil.putRetainNull(json, "id", deployment.getId());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONUtil.putRetainNull(json, "name", deployment.getName());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String deploymentTime = JSONUtil.formatISO8601Date(deployment.getDeploymentTime());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSONUtil.putRetainNull(json, "deploymentTime", deploymentTime);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return json;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;…&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;The result model created by the existing DeploymentsGet is used to create a JSONObject. THe DeploymentJSONConverter is reusable, this calls our model's getters to get the data into JSONObject. Adding paging info can be done in a generic way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;* Only the rendering has been altered, &lt;/SPAN&gt;&lt;STRONG&gt;the web script implementations haven't changed a single letter&lt;/STRONG&gt;&lt;SPAN&gt;, so all the UI-guys' hard work hasn't gone to waste &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; Other representations can still be plugged in using the normal webscript-way offcourse.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* JSONUtil has some convenience methods to add values/arrays and format dates using the spring-surf iso8601DateFormatter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_____________________________&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, Exporer and Probe run fine with the new implementations. Although, we should have the REST covered by unit/integration tests. Looks like we have 2 options:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;* Use embedded tomcat which enables us to sue the same ProcessEngine, so we can set up some test-data using the API and pull it out using Restlet (which provide one-liners to do a single rest-call)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* Use WebScriptTestServer which is present in /scr/test/java of spring-surf webscripts. I can't seem to find out how to get it running, but I hope Eric can give me a few pointers on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;WDYT?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 15:48:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8719#M2912</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2010-11-05T15:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8720#M2913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, here comes a bit of pro-freemarker feedback, since I i'm not 100% about the new solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please note that this response is only about response rendering, it has nothing to do with having a core api and additional ui rest apis.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I've understood the complaints against templates are basically 2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1. An engine api change might break the rest api.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is true and a good argument. It can be solved by the junit tests. Joram showed me some Alfresco tests that did it and seemed satisified with how it was done. Alfresco is using this for their rest api having thousands of lines of freemarkerjson responses and it works for them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2. Its hard for the engine team to maintain since you don't know freemarker.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Well I hope I'm not being hard on you know, but its like saying I don't want to use Activiti for processes since I already know BPM4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And since we are planning to use freemarker in the forms, you will need to learn it anyway &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway Freemarker is extremely easy to learn and use, and in the bottom is a crash course containing all you need for Activiti development.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Why I think programmatic rendering is a bad idea:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A. The overview of how the JSON response looks is totally lost.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;B. The amount of code lines needed are much greater, just consider the condition examples below to be written in java.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C. The benefit of getting a toJSON method in all pojos and use them in the rest api is not realistic since the pojo model will never match the services methods in 100%, some examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - Task (resourceName isn't included anymore therefore needing a whole new class RestTask on some objects but not all, confusing an creates even more code to maintain)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - RestProcessDefinition (same story as line above)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;D. More examples where the POJO doesn't match a response:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - In the /process-engine response ProcessEngineInfo doesn't cover the complete response and additional "version" attribute is required)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;E. "modern" frameworks like rails, django use templates making it easier to use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;F. Freemarker is a robust framework with very good documentation: &lt;/SPAN&gt;&lt;A href="http://freemarker.sourceforge.net/docs/index.html" rel="nofollow noopener noreferrer"&gt;http://freemarker.sourceforge.net/docs/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;G. We don't use the webscripts framework in a way its not intended.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(H). Most of all alfrescans and alfresco users as well for that matter know how to use json in freemarker and the webscripts api making it easy for them to read and understand the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;############################&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# FREEMARKER CRASH COURSE: #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;############################&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Examples&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello ${user.firstName}!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Prints firstName if it exists, if it doesn't it will crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello ${user.firstName!"Guest"}&amp;nbsp; // Prints firstName if it exists, if it doesn't exist the defatul value 'Guest' will be printed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A number ${count}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Will print and format ok as long as it doesn't exceed the number 1000, then it will be printed as "1 000"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A number ${count?c}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // will be printed as expeceted (i.e. "1000")&amp;nbsp; for all values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A date ${iso8601Date(today)}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This is how we print dates in the activiti rest so its formatted as iso8601 dates&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To use macros string escaping and library files:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; activiti.lib.ftl ( a file with a macro inside)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;——————————————————&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#escape x as jsonUtils.encodeJSONString(x)&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#macro printName name&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Name: ${name}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/#macro&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/#escape&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; … can be used and imported as a lib in another file as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;————————————————————&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#import "../activiti.lib.ftl" as restLib&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;@restLib.printName "Erik Winlöf"/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All strings will be json-escaped but the int &amp;amp; dates will need special formatted as explained above.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Conditions example that checks if the name is defined or not:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"name": &amp;lt;#if processDefinition.name??&amp;gt;"${processDefinition.name}"&amp;lt;#else&amp;gt;null&amp;lt;/#if&amp;gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;List example that uses the "freemarked built in" of "_has_next" to decide if a comma sign shall be printed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;#list processDefinitions as processDefinition&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "id": "${processDefinition.id}",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "key": "${processDefinition.key}",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": &amp;lt;#if processDefinition.name??&amp;gt;"${processDefinition.name}"&amp;lt;#else&amp;gt;null&amp;lt;/#if&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&amp;lt;#if processDefinition_has_next&amp;gt;,&amp;lt;/#if&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/#list&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 10:12:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8720#M2913</guid>
      <dc:creator>erikwinlof</dc:creator>
      <dc:date>2010-11-09T10:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8721#M2914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I did a quick count of the amount of code needed to support and write in the 2 implementations (and note that the numbers first numbers below include the whole cycle rest api implementation for the freemarker version but not in the java version).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Number of lines of code in freemarker version&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%&amp;gt; find resources/webscripts/org/activiti/rest/api/ -type f -name "*ftl" -exec wc -l {} \; | awk '{total += $1} END{print total}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;411&amp;nbsp; (actually 278 without the cycle implementations 133 rows)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Number of lines of code in java version&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%&amp;gt; find java/org/activiti/rest/builder/ -type f -name "*java" -exec wc -l {} \; | awk '{total += $1} END{print total}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1475&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Number of characters of code in freemarker version&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%&amp;gt; find resources/webscripts/org/activiti/rest/api/ -type f -name "*ftl" -exec wc -c {} \; | awk '{total += $1} END{print total}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;12613 (actually 7998 minus the cycle implementations 4615 characters)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Number of lines of code in java version&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%&amp;gt; find java/org/activiti/rest/builder/ -type f -name "*java" -exec wc -c {} \; | awk '{total += $1} END{print total}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;49819&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So as long as I have typed these commands properly, apologies otherwise :-), it meant that when excluding the cycle rest api the java implementation requires:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5.3 times more lines&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6.2 times more characters &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;than the freemarker implementation… at its current state!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 10:51:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8721#M2914</guid>
      <dc:creator>erikwinlof</dc:creator>
      <dc:date>2010-11-09T10:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8722#M2915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Once we are confident about the solution, the ftl's are removed and JSONObject stuff kicks in.&lt;BR /&gt;[…]&lt;BR /&gt;WDYT?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still not confident that this is the best approach. I think the above demonstrates how hard the new REST API would be for non Java developers to follow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The templating layer (in addition to all the other benefits) gives visibility over the expected results, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;e.g.: The FTL files generally contain something along the lines of this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;{&lt;BR /&gt;&amp;nbsp; "id": "${processDefinition.id}",&lt;BR /&gt;&amp;nbsp; "key": "${processDefinition.key}",&lt;BR /&gt;&amp;nbsp; "name": &amp;lt;#if processDefinition.name??&amp;gt;"${processDefinition.name}"&amp;lt;#else&amp;gt;null&amp;lt;/#if&amp;gt;,&lt;BR /&gt;&amp;nbsp; "version": ${processDefinition.version},&lt;BR /&gt;&amp;nbsp; "deploymentId": "${processDefinition.deploymentId}",&lt;BR /&gt;&amp;nbsp; "resourceName": "${processDefinition.resourceName}",&lt;BR /&gt;&amp;nbsp; "startFormResourceKey": &amp;lt;#if processDefinition.startFormResourceKey??&amp;gt;"${processDefinition.startFormResourceKey}"&amp;lt;#else&amp;gt;null&amp;lt;/#if&amp;gt;&lt;BR /&gt;}&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Having the response spelled out like that gives developers an easily accessible reference as to what properties they can expect, where they come from and which ones might be null. If any properties were formatted (e.g. dates or numbers) it would show what format should be expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can front end Activiti developers or developers of third party applications (who may not be working in Java and may not have a Java IDE) determine the same information with your JSONObjectBuilder approach?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 11:32:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8722#M2915</guid>
      <dc:creator>davidcognite</dc:creator>
      <dc:date>2010-11-09T11:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8723#M2916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Any thoughts from the rest? ( sorry about that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Personally I think we shall stick with the freemarker, since I can't see the "win" of using the JSONObject approach (except for getting the possible refactor errors when running compile rather than running test).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;:: Erik&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 15:25:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8723#M2916</guid>
      <dc:creator>erikwinlof</dc:creator>
      <dc:date>2010-11-09T15:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: new rest2 webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8724#M2917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wasnt able to follow the discussion every line, but here's my opinion on some of the points:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;B. The amount of code lines needed are much greater, just consider the condition examples below to be written in java.&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;* LOC's don't mean anything. With auto-completion, auto-import, etc that every IDE has, I dont think you claim that LOC = productivity. We're not the eighties anymore.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;C. The benefit of getting a toJSON method in all pojos and use them in the rest api is not realistic since the pojo model will never match the services methods in 100%, some examples:&lt;BR /&gt;- Task (resourceName isn't included anymore therefore needing a whole new class RestTask on some objects but not all, confusing an creates even more code to maintain)&lt;BR /&gt;- RestProcessDefinition (same story as line above)&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;These were just hacks introduced as a last-minute fix in the last release. There are jira issues to replace these with proper handling.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;E. "modern" frameworks like rails, django use templates making it easier to use.&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;* 'modern' frameworks such as (G)Rails *do not* have templating as their primary rendering method as you state. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;They use a much more powerful concept called builders, which comes closer to the Java approach: &lt;/SPAN&gt;&lt;A href="http://www.grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.1.7%20XML%20and%20JSON%20Responses" rel="nofollow noopener noreferrer"&gt;http://www.grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.1.7%20XML%20and%20JSON%20Responses&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In fact, in Rails you could use templating for json. But the more accepted practice is to call .to_json() on whatever you want to expose.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;F. Freemarker is a robust framework with very good documentation: &lt;A href="http://freemarker.sourceforge.net/docs/index.html" rel="nofollow noopener noreferrer"&gt;http://freemarker.sourceforge.net/docs/index.html&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;So is Java.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;G. We don't use the webscripts framework in a way its not intended.&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Why not? Who decides on that? For me, it is a natural addition to webscripts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 17:09:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/new-rest2-webapp/m-p/8724#M2917</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2010-11-09T17:09:49Z</dc:date>
    </item>
  </channel>
</rss>

