Java Reference
In-Depth Information
Now that we have verified our RESTful web service was deployed successfully, the
next step is to implement a client application that uses our service. But before doing
so let's take a look at the NetBeans generated
ApplicationConfig
class, which can
be seen by expanding the
Generated Sources (rest)
node in the project view.
The source code for this class looks like this:
package org.netbeans.rest.application.config;
/**
* This class is generated by the Netbeans IDE,
* and registers all REST root resources created in the project.
* Please, DO NOT EDIT this class !
*/
@javax.ws.rs.ApplicationPath("resources")
public class ApplicationConfig extends javax.ws.rs.core.Application {
}
As we can see, the body of this class is empty, the purpose of this class is to configure
JAX-RS, and therefore no actual code needs to be generated. The only requirement
is that the class extends
javax.ws.rs.core.Application
and for the class to be
annotated with the
@javax.ws.rs.ApplicationPath
annotation. This annotation
is used to specify the base URI of all paths specified by the
@Path
annotation in our
RESTful web services classes. NetBeans by default uses a path named
resources
for
all RESTful web services.