Book Image

Java EE 7 Development with NetBeans 8

By : David R Heffelfinger
5 (1)
Book Image

Java EE 7 Development with NetBeans 8

5 (1)
By: David R Heffelfinger

Overview of this book

Table of Contents (18 chapters)
Java EE 7 Development with NetBeans 8
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Generating RESTful Java client code


NetBeans provides a wizard that can automatically generate client Java code that invokes our RESTful web service methods via the corresponding HTTP requests.

To generate this client code in a Java application project, we simply need to go to File | New File, select the Web Services category, and select RESTful Java Client as the file type.

In the next step in the wizard, we need to enter a class name and a package name for our JAX-RS client.

Note

Jersey is the JAX-RS implementation included with GlassFish. Since we are using the GlassFish application server included with NetBeans, NetBeans uses a default name NewJerseyClient for the Class Name field; this default class name will suffice for our purposes.

Then, we need to select the RESTful web service that our client will consume. In our case, we need to select the From Project radio button under Select the REST resource and click on the button labeled Browse.

Then, we simply need to select the RESTful web service...