Logo

LH API Showcase is a simple web app that provides a showcase for the Lufthansa Open API.

This app is written in Java and is developped using the GWT framework. It reposes on the MVP architecture (Model–View–Presenter) as described in the article Building MVP apps. This sample project provides:

This should be of interest for a wide range of prospective developers: Android native app, webapp and more generally multi-platform mobile HTML5 applications (see, e.g., PhoneGap).

The LH API is queried on the server side (hence the possible need for proxy setting–see next section). The client invokes the services via GWT RPCs.

Settings

The file Showcase-settings.xml (located in src\main\resources\lh\api\showcase) can be used to specify the required authentication information (obtained after successfully registering to the LH API).

Furthermore, if the server is behind a proxy, the parameters can be specified in this setting file as well.

Here an example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings>
<authentication>
	<api>
		<key>client id</key>
		<secret>client secret</secret>
		<callback>http://example.com:8080</callback>
	</api>
</authentication>
<proxy>
	<http>
		<port>8080</port>
		<active>true</active>
		<user>username</user>
		<password>password</password>
		<host>proxy host</host>
	</http>
</proxy>
</settings>

Compiling and Testing

After cloning the repository, the following commands should be used:

mvn clean # can be omitted the first time
mvn gwt:generateAsync
mvn package

Then, the application can be launched locally in development mode with the command (see Compiling and Debugging for further details):

mvn gwt:run

Note that we assume that maven is installed (as well as, obviously, an adequate Java SDK).

To open the project in Eclipse, the following command might prove useful:

mvn eclipse:eclipse

Live Demo

This app is online at lh-api-showcase.appspot.com.

License and Source Code

© 2014 Loic Merckel, Apache v2 licensed. The source code is available on GitHub.