Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Trimou - Ping Example

This example web application aims to show the basic usage of Trimou, built-in extensions for CDI, Servlet, PrettyTime and HtmlCompressor, and Rewrite integration.

The app contains two Java EE components - a servlet and a JAX-RS resource. Both provide the same functionality:

  1. Store a "ping" request
  2. Get "ping" requests HTML page

However, the JAX-RS resource is using CDI bean resolver whereas the servlet is not. Also note that the servlet is using the provided Writer instance.

Rewrite configuration enables you to get rendered templates directly at some specific path - in our example the web app root.

Build, deploy, test

  1. build mvn clean install
  2. deploy the artifact target/trimou-ping.war to your favourite Java EE 6+ container (if you want to deploy the app to a servlet container you'll have to budle CDI implementation first, e.g. Weld Servlet Uber Jar)
  3. test the application, e.g. using wget and curl tools

To test servlet components:

curl -X POST http://localhost:8080/trimou-ping/ping
wget -O - http://localhost:8080/trimou-ping/ping

To test JAX-RS components:

curl -X POST http://localhost:8080/trimou-ping/rest/ping
wget -O - http://localhost:8080/trimou-ping/rest/ping

To test Rewrite configuration:

wget -O - http://localhost:8080/trimou-ping/pingLogCdi.html
(you should get the same result as for the JAX-RS resource)

To display simple stats:

wget -O - http://localhost:8080/trimou-ping/rest/stats