Skip to Content
RESTful Java with JAX-RS
book

RESTful Java with JAX-RS

by Bill Burke
November 2009
Intermediate to advanced
310 pages
7h 42m
English
O'Reilly Media, Inc.
Content preview from RESTful Java with JAX-RS

Chapter 16. Examples for Chapter 3

Chapter 3 walked you through a very basic example of creating a JAX-RS service. This service was a simple in-memory customer database. It was modeled as a singleton JAX-RS resource class and exchanged simple XML documents.

This chapter takes the code from Chapter 3 and shows you how to run it using the downloadable workbook example code. I’ll walk you through how the code is structured on disk as well as how the examples use the Maven build system to compile, build, and run it.

Build and Run the Example Program

Perform the following steps:

  1. Open a command prompt or shell terminal and change to the ex03_1 directory of the workbook example code.

  2. Make sure your PATH is set up to include both the JDK and Maven, as described in Chapter 15.

  3. Perform the build by typing maven install. Maven uses pom.xml to figure out what to compile, build, and run the example code.

Before we examine the build file for this example, you might want to take a quick look at the Maven utility at its Apache website at http://maven.apache.org.

Maven is a build-by-convention tool. It expects that your source code be laid out in a certain directory structure. From this standard directory structure, it knows how to automatically find, compile, and package your main class files. It also knows where your test code is and will compile and run it.

Every exercise in this book will follow the directory structure shown in Figure 16-1. Table 16-1 describes the purpose of the various directories. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

RESTful Java with JAX-RS 2.0, 2nd Edition

RESTful Java with JAX-RS 2.0, 2nd Edition

Bill Burke
RESTful Java Web Services - Third Edition

RESTful Java Web Services - Third Edition

Balachandar Bogunuva Mohanram

Publisher Resources

ISBN: 9780596809300Supplemental ContentErrata Page