In this blog series we presented various blogs on Tapestry with the goal to show how to build a simple "Hello World" style application that gives GUI using HTML pages and presents a WEB API. By using Stream Response it's possible for Tapestry to return a stream, and with that we build a simple API. Testing this setup is a little involved and explained in detailed in the last blog of the series. We present a short overview of the blogs here.
Tapestry - Part I: Hello Tapestry
In this blog we create a hello-world style example using Tapestry 5. The goal of this example is to get you up and running with Tapestry using the skeleton setup that is included with Tapestry. Based on this initial setup we make changes to get a hello-world page.
Tapestry - Part II: Simple WEB API using Tapestry
In this blog we extend your Tapestry projects with a simple API. If you have a big project and need complex calls to expose your API functions, then this approach is not for you. Instead, if you have a couple of functions you would like to expose, this is a quick and simple approach to get it done.
Tapestry - Part III: Input Validation
Up until this point we showed how to setup a simple “hello world” web application using Tapestry including an API. One of the issues we ran into is that some names are reserved in the application for page names, so they can’t be used as input names for the application. In this blog we show how the input can be filtered and meaningful error messages can be created for the user. This approach allows you to create a better user experience and safer applications.
Tapestry - Part IV: Extended API using XML
In this blog we extend the API that can already return JSON in such a way that it can also returns XML.
Tapestry part V - Testing a page
In this blog we demonstrate how to test a webpage within the Tapestry framework. The framework comes with a few handy testing options. Here we will consider the PageTester object, which can be used to replicate interactions between user and application. It deals with all input and output on the pages. As such it is great for User Acceptance Testing and Unit Testing.
Tapestry part VI - Testing a WEB API
In this blog we test a WEB API created using Tapestry. Testing a web service is not straight forward as the PageTester, the default way of testing in Tapestry, doesn't allow for testing API. To solve this we must start a Jetty server with custom/test web.xml. The test web.xml allows us to control the construction of objects. In this example we show how a mock service object can be inserted for testing, while using the full implementation for production.
The code can be downloaded as you go through the blogs. If you are interested in jumping straight to the end result we suggest using the code we shared on GitHub.