Skip to content

Building and Running the Example

gsteinacker edited this page Nov 11, 2012 · 4 revisions

Project Setup

  1. Download and unpack the project
  2. Install Gradle

Building the Project

Simply run gradle build

Running the examples

There are two example: a "Hello World" and a slightly larger one "Shop".

In order to run one of the example, you should change into the directory and:

  • Execute 'gradle jettyRun'.
  • Open the example in a browser: 'http://localhost:8080/shop/storefront'
  • Open the generated json-home document using a REST client: 'http://localhost:8080/shop/json-home' with Request Header 'Accept: application/json' or 'application/json-home'. The latter accept header will return a json-home document, only containing the elements defined by the (draft) specification, using application/json MAY return more data in addition to the specification.

Project Structure

The Json-Home project contains three modules:

  1. jsonhome-core: a library containing a simple domain model, representing the resources of a web application.
  2. jsonhome-generator: base classes used to build json-home generators.
  3. jsonhome-spring: the Spring controllers used to build a Spring-based web application. Contains a Spring-MVC implementation of a JsonHomeGenerator.
  4. jsonhome-examples/helloworld: a minimal Spring-based web application, showing the usage of jsonhome-core and jsonhome-spring.
  5. jsonhome-examples/shop: a very basic shop-like application, having more resources and different representations. This example also shows how to integrate jsonhome into an application that is using Freemarker templates.