Java Reference
In-Depth Information
NetBeans overrides the
getClasses()
method of
javax.ww.rs.core.Application
and makes it return a set of classes containing all of the RESTful web services in our
application (classes annotated with the
@Path
annotation). NetBeans automatically
adds all of our RESTful web services in the
addRestResourceClasses()
method,
and invokes this method from the generated
getClasses()
method.
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.