Procedure
-
From a command-line windows, navigate to the jax-rs folder and type
mvn clean install eclipse:eclipse
. This will create an Eclipse project out of this sample that we can import into Eclipse. -
From Eclipse we can now import the project. From the Menu row, select File : Import..., and from the resulting Import popup, choose
Existing Projects into Workspace (see
illustration below). Select Next.
-
Select the four Eclipse projects comprising this example: jaxrs-intro-client, jaxrs-intro-common,
jaxrs-intro-service-bundle, and jaxrs-intro-service-war. You'll see them listed in the
left-side Eclipse Navigator and Project Explorer views. At this stage any of the files can be viewed and modified. Be sure to
run
mvn clean install
from the jaxrs-intro folder within a command prompt window after any changes made. -
Prior to running the client, we'll need to activate the REST service, which we can do in at least two ways:
-
To run the example within Talend ESB, we'll need to create the Karaf features file that contains the definition for this service. First, from a command prompt navigate to the features folder (sibling to jaxrs-intro) and run
mvn clean install
. Next, from the command prompt enterfeature:repo-add mvn:com.talend.sf.examples/osgi/1.0/xml/features
to install the features file followed byfeature:install tsf-example-jaxrs-intro
to install the JAXRS-Intro service. -
To run the example within CXF's internal (Jetty-based) servlet container, navigate to the war folder and run
mvn jetty:run
.
-
-
To run the client, from a command prompt in the jaxrs-intro/client folder, run
mvn exec:java
.