tree: 9d5ef3978a0f5d8dfc4c0edb0ff8e270198dc035 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.MD
examples/freemarker-webapp/README.MD

Freemaker example

This example demonstrates how to use Freemarker templating engine to produce web pages via Jersey viewable support.

Contents

The mapping of the URI path space is presented in the following table:

URI pathResource classHTTP methods
/helloFreemarkerResourceGET
/autoTemplateFreemarkerResourceGET
/helloWithoutSuffixFreemarkerResourceGET

See FreemarkerResource for details on how to use jersey-freemaker-webapp module for generating web pages.

If you want to use freemarker in your project, don't forget to set “jersey.config.freemarker.TemplateBasePath” init param, which will be pointing to base directory where your templates are stored (FreemarkerTest class does that).

Running the Example

Run the tests of the example as follows:

mvn clean test

This deploys this example using Grizzly and executes the Jersey Test Framework using the unit test framework.

You can see test classes at src/main/test subdirectory for detailed information how to consume the service using Client API.

Run the example as follows:

mvn clean package jetty:run

This deploys current example using Jetty. You can access the application at http://localhost:8080/freemarker-webapp/hello