RESTful Web Service Implementation with RESTEasy

2 min read

Getting the tools

If you have already downloaded and installed Java’s JDK and the Tomcat web server, you only need to download the JBoss’s RESTEasy framework. Nevertheless, the complete list of the software needed for this article is as follows:

Software

Web Location

Java JDK

http://java.sun.com/

Apache Tomcat

http://tomcat.apache.org/download-60.cgi

Db4o

http://developer.db4o.com/files/default.aspx

RESTEasy Framework

http://www.jboss.org/resteasy/

Install the latest Java JDK along with the latest version of Tomcat, if you haven’t done so. Download and install Db4o and RESTEasy. Remember the location of the installs, as we’ll need the libraries to deploy with the web application.

RESTEasy — a JAX-RS implementation

  RESTEasy is a full open source implementation of the JAX-RS specification. This framework works within any Java Servlet container, but because it’s developed by JBoss, it offers extra features that are not part of the JAX-RS requirements. For example, RESTEasy offers out-of-the-box Atom support and also offers seamless integration with the EJB container portion of JBoss (none of these features are explored here).

Web service architecture

By now, you should be familiar with the coding pattern. Because we want to reuse a large portion of code already written, we have separate layers of abstraction. In this article, therefore, we only talk about the web layer and study in detail how to implement a full RESTful web service using RESTEasy.

The full architecture of our web service looks as follows:

In this diagram, we depict clients making HTTP requests to our web service. Each request comes to the web container, which then delegates the request to our RESTful layer that is composed of RESTEasy resource classes. The actual serialization of user and message records is delegated to our business layer, which in turns talks directly to our database layer (a Db4o database).

Again, RESTEasy is a platform independent framework and works within any Servlet container. For this article we deploy our web service in Tomcat, as we’ve been working with it so far and are now familiar with deploying web applications to it, though we could as easily use the JBoss web container.

Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago