Introduction: Apache Wink is an open source implementation of the JAVA™API for RESTful Web Services (JAX-RS) specification. Learn how to develop, deploy, and run RESTful Web services using the Apache Wink, the Eclipse IDE, and the Maven project management tools.
Apache Wink is an Apache incubator project that facilitates the creation and use of REST Web services. With the REST Web service, the interaction between the client and the service is limited to a predefined set of operations, and the complexity of the interaction between the client and the server limits the resource representation of the exchange between the client and the service. This approach supports building a interoperable, scalable, reliable, REST-based, distributed hypermedia system.
Common abbreviations
API: Application Programming Interface
HTTP: Hypertext Transfer Protocol
IDE: Integrated development environment
Json:javascript Object Symbol
REST: Representational State transmission
URI: Uniform Resource Identifier
XML: Extensible Markup Language
This article describes how to develop, deploy, and run RESTful Web services using the Apache Wink, the Eclipse IDE, and the Maven Project management tool.
REST Methods for WEB Services
The REST method of designing a WEB service restricts interaction between clients and services to a set of Create, read, update, and delete (CRUD) operations. These actions are mapped directly to the HTTP method-specifically, to POST, get, put, and DELETE. Although the RESTful style is not bound to the HTTP protocol, this article assumes that HTTP is used for communication between clients and services.
The REST Web Service performs CRUD operations on resources. The client uses the REST service representation of the resource state for Exchange. These representations use data formats that specify-xml and JSON in the header of an HTTP request or response is a widely used format. The data format may change between different operations; For example, the data format for creating a resource differs from the data format used to read the resource. The REST service maintains the state of the resource, but-unlike servlets-does not maintain client-session information.
The rest method supports building interoperable, scalable, and reliable, rest-based distributed systems. For example, the GET, POST, and DELETE methods are idempotent, that is, executing them multiple times and performing the same result once. Because a get operation does not change the state of a resource, the result of a pull request can be cached to speed up the request-response loop.
Jax-rs defines an API for RESTful Java Web services based on the HTTP protocol. JAX-RS implementations include Apache Wink, Sun Jersey, and JBoss resteasy. This article will use the Apache Wink.
Using the power of Java annotations, Jax-rs uses annotations to perform actions such as the following:
Ways to bind HTTP methods and URIs to Java classes
To inject an element from a URI or HTTP header as a method parameter
Converting between HTTP message body and Java type
Binding URI patterns to Java classes and methods-@Path annotations
Binding HTTP Operations to Java methods-@GET, @POST, @PUT, and @DELETE annotations
JAX-RS also provides a framework to build new functionality. For example, for custom data formats, programmers can develop message readers and group Java objects into HTTP messages and extract them from an HTTP message.
In this article, you will use Eclipse and Maven to download the Apache Wink, run the HelloWorld sample contained in Apache Wink, and then create your own REST Web service as an Eclipse project.
Get Apache Wink via Eclipse
In this section, you will use Eclipse and the Maven integration for Eclipse (called the M2eclipse) and the Subclipse plug-in to install the Apache Wink. (M2eclipse provides access to Maven from Eclipse; Subclipse provides access to the Subversion repository.) You can also use Eclipse as a platform to build and run WEB services from this platform.