Splatforms and Apache Velocity

Posted on July 18, 2010
Filed Under Splatforms | 2 Comments | Share this post via splatforms.com

We are firm believers in Open Source software here at Splatforms.com. Many of things that we are able to do here would not be possible without the vast array of Open Source software products available today. We try to credit as many of the major players as we can think of, but there are far many others that you do not see listed. One of the products that we do list is Apache Velocity. According to their web site:

Velocity is a Java-based template engine. It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.

When Velocity is used for web development, Web designers can work in parallel with Java programmers to develop web sites according to the Model-View-Controller (MVC) model, meaning that web page designers can focus solely on creating a site that looks good, and programmers can focus solely on writing top-notch code. Velocity separates Java code from the web pages, making the web site more maintainable over its lifespan and providing a viable alternative to Java Server Pages (JSPs) or PHP.

Velocity’s capabilities reach well beyond the realm of the web; for example, it can be used to generate SQL, PostScript and XML (see Anakia for more information on XML transformations) from templates. It can be used either as a standalone utility for generating source code and reports, or as an integrated component of other systems. For instance, Velocity provides template services for the Turbine web application framework, together resulting in a view engine facilitating development of web applications according to a true MVC model.

For additional information on Velocity, see their User Guide at http://velocity.apache.org/engine/devel/user-guide.html.

Our use of Velocity is focused on the Steps that make up the various Tasks behind each *form. Steps are carried out on your local machine by your *forms Local Agent at the direction of the Dispatcher on the Splaforms.com web site. The instructions for each Step include several items such as an HTTP method, a target URL, optional parameters, and various other elements such as HTTP headers or cookies. Many of these elements contain placeholders, or variables, and Velocity is used by the Local Agent to replace those placeholders with actual values at execution time.

Here is a typical list of HTTP POST Parameters from a Task that posts a Link *form to Tumblr as a blog entry:

generator=Tumblr Link Post by Joe Tasker via splatforms.com

Most of the Velocity syntax that you see there is simple variables, but if you look at the form field called private you can see just a little bit of VTL (Velocity Template Language) logic that goes beyond simple placeholder resolution. Velocity gives Task developers the ability to include such logic in the Steps for their Tasks, which gives them the ability to do a number of things that they simply could not without it.

Apache Velocity is just one more item in a long list of Open Source products that has made it possible to create the service that we provide here at Splatforms.com.


2 Responses to “Splatforms and Apache Velocity”

  1. More Fun with Velocimacros : Splatforms on May 23rd, 2011 12:25 pm

    […] of many open source products that has helped to make Splatforms.com what it is today is Apache Velocity. One of the most powerful features of Velocity is the ability to create reusable functions known as […]

  2. Build Your Own *form Task : Splatforms on August 27th, 2011 5:05 pm

    […] workings of the Splatforms.com infrastructure, including the role of the *forms Local Agent, the Velocity scripting language, XML syntax, and the intimate details of the operation of the specific target site for which the […]