Links: Table of Contents | Single HTML

Chapter 1. Getting Started

This chapter provides a quick introduction on how to get started building RESTful services using Jersey. The example described here uses the lightweight Grizzly HTTP server. At the end of this chapter you will see how to implement equivalent functionality as a JavaEE web application you can deploy on any servlet container supporting Servlet 2.5 and higher.

1.1. Creating a New Project from Maven Archetype

If you want to depend on Jersey snapshot versions the following repository needs to be added to the pom:

<repository>
    <id>snapshot-repository.java.net</id>
    <name>Java.net Snapshot Repository for Maven</name>
    <url>https://maven.java.net/content/repositories/snapshots/</url>
    <layout>default</layout>
</repository>

Now, to create a new Jersey project, based on Grizzly 2 container, from a maven archetype, execute the following in the directory where the new project should reside:

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example -DarchetypeVersion=2.0-m13-1

Feel free to adjust the group id, package name and artifact id of your new project in the line above, or you can change it after it gets generated by updating the project pom.xml

1.2. Exploring the Newly Created Project

TODO

1.3. Customizing the JAX-RS Resource

TODO: instructions on how to make simple edits to the newly created resource

1.4. Running the Project

TODO: instructions on how to run the project

1.5. Creating a JavaEE Web Application

TODO

1.6. Exploring Other Jersey Examples

Jersey codebase contains a number of useful samples on how to use various JAX-RS and Jersey features. Please refer to the [TODO: Examples] section of this guide for more information on those.