No description, website, or topics provided.
Java JavaScript
Pull request Compare This branch is 48 commits behind aerogear:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status

AeroGear Controller Demo - very lean mvc controller

AeroGear Controller is a very lean model view controller written in Java. It focuses on the routing of HTTP request to plain Java object endpoint and the handling of the returned result. The result of an invocation is either forwarded to a view, or returned in the format requested by the caller

This project show cases some of the functionality of AeroGear Controller.

An instance of this demo is deployed on OpenShift, but it can also be deployed locally. Please refer to the installation section for deploying locally.

Demo Contents

This demo project has a number of routes, some are used in a MVC fashion while others are expected to be called as RESTful resources.

Model View Controller Routes

These routes are used for the web based interface which you can find on OpenShift. Please refer to the user guide for detailed information about configuring routes.

RESTful Controller Routes

There are few routes that are intended to respond with JSON data. These routes deal with the /cars resource and demonstrate pagination.
The basic idea is that a client wants to limit the number of cars it receives per request to a certain number.

Requesting the first set of cars:

 curl -i --header "Accept: application/json" ""

Running the above command will produce output similar to the below:

HTTP/1.1 200 OK
Link: <>; rel="next"
Content-Type: application/json;charset=UTF-8
Content-Length: 194

By default, AeroGear Controller uses Web Linking specification and the Link header above is an example of this. A client can use these links to navigate, to the next/previous page.

Requesting the next set of cars:

To retrieve the next set of cars, use the URL from next (see the Link header in the previous example):

 curl -i --header "Accept: application/json" ""

Basic / Digest Authentication

The demo has built-in support for HTTP Basic / Digest authentication. Because both authentication schemas can't coexist, Digest authentication is enabled and configured by default. To switch the authentication schema (e.g. Basic), uncomment and comment the appropriate sections in the app's web.xml file.

Testing HTTP Basic authentication

 curl --basic -b cookies.txt -c cookies.txt -u john:123 "" -v

Testing Digest authentication

 curl --digest -b cookies.txt -c cookies.txt -u agnes:123 "" -v

Note: for Digest authentication, a username called 'agnes' is configured instead of 'john' as in 'Basic' authentication.


Building the project is done using maven:

mvn install


An AeroGear Controller application can be deployed to any application server with a CDI container.
However, this demo uses a datasource that by default exists in JBoss AS 7.x and it is the preferred deployment environment.

Manual deployment

$ cp target/aerogear-controller-demo.war $AS7_HOME/standalone/deployments

CLI deployment

$ cd $AS7_HOME
$ ./ --connect
$ [standalone@localhost:9999 /] deploy /path/to/aerogear-controller-demo/target/aerogear-controller-demo.war



Issue Tracker