Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Creating a JAX-RS Web Service"

 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
1. Create a JAX-RS User library from the .jar files in this Apache WINK JAX-RS Implementation library:
 +
 
[[Image:ApacheWinkJAXRSLibrary.zip]]  
 
[[Image:ApacheWinkJAXRSLibrary.zip]]  
  
 +
[[Image:Snap5.jpg]]
  
 +
<br>
  
1. Create a JAX-RS User library from the .jars in the archive above:[[Image:Snap5.jpg]]  
+
2. Create a Dynamic Web Project targeting Tomcat and add the JAX-RS facet, specify '''org.apache.wink.server.internal.servlet.RestServlet''' as the JAX-RS&nbsp; servlet class name on the JAX-RS Capabilities page:<br> [[Image:Snap1.jpg]] [[Image:Snap6.jpg]]  
  
 +
<br> 3. Import the Src.zip archive below into the src folder of the JAXRS project:
  
 
+
[[Image:Src.zip]]  
2. Create a Dynamic Web Project targeting Tomcat and add the JAX-RS facet:<br> [[Image:Snap1.jpg]]
+
 
+
 
+
 
+
3. Import
+
 
+
<br>
+
 
+
[[Image:JAXRS.zip]]  
+
  
 
[[Image:Snap4.jpg]]  
 
[[Image:Snap4.jpg]]  
  
[[Image:Snap6.jpg]]
+
<br> 4. Add an Initialization parameter to the JAX-RS Servlet:
  
 
[[Image:Snap7.jpg]]  
 
[[Image:Snap7.jpg]]  
  
Define the Initialization parameter name/value as javax.ws.rs.Application/com.test.AddressBookApplication like below.
+
5. Define the Initialization parameter name and value as '''javax.ws.rs.Application''' and '''com.test.AddressBookApplication''':  
 
+
[[Image:Snap8.jpg]]
+
  
 
[[Image:Snap9.jpg]]  
 
[[Image:Snap9.jpg]]  
  
Start the server and add the JAXRS project, enter the following URL in the browser to test the JAX-RS Web Service: http://localhost:8080/JAXRS/jaxrs/addresses  
+
6. Start the server and add the JAXRS project to the server, enter the following URL in the browser to test the JAX-RS Web Service and obtain the addresses in the AddressBook:
  
[[Image:Snap11.jpg]]
+
http://localhost:8080/JAXRS/jaxrs/addresses [[Image:Snap11.jpg]]

Latest revision as of 21:38, 29 April 2010

1. Create a JAX-RS User library from the .jar files in this Apache WINK JAX-RS Implementation library:

File:ApacheWinkJAXRSLibrary.zip

Snap5.jpg


2. Create a Dynamic Web Project targeting Tomcat and add the JAX-RS facet, specify org.apache.wink.server.internal.servlet.RestServlet as the JAX-RS  servlet class name on the JAX-RS Capabilities page:
Snap1.jpg Snap6.jpg


3. Import the Src.zip archive below into the src folder of the JAXRS project:

File:Src.zip

Snap4.jpg


4. Add an Initialization parameter to the JAX-RS Servlet:

Snap7.jpg

5. Define the Initialization parameter name and value as javax.ws.rs.Application and com.test.AddressBookApplication:

Snap9.jpg

6. Start the server and add the JAXRS project to the server, enter the following URL in the browser to test the JAX-RS Web Service and obtain the addresses in the AddressBook:

http://localhost:8080/JAXRS/jaxrs/addresses Snap11.jpg

Back to the top