Working with JAX-RS

JAX-RS
Overview
Difficulty
Intermediate
Duration
1h 8m
Description

This course takes an in-depth look at Java API for RESTful Web Services, otherwise known as JAX-RS. We also run through some example exam questions that will be useful for anyone who wants to take Oracle's Java EE exam.

Learning Objectives

  • Understand the fundamentals of JAX-RS
  • Learn about the main concepts and components of JAX-RS

Intended Audience

This course is intended for anyone who already has basic knowledge of Java and now wants to learn about Java EE 6.

Prerequisites

Basic knowledge of Java programming.

Transcript

Hello dear friends. In this video, we will examine the JAX-RS as Java RESTful Service, let's begin. JAX-RS stands for Java API for RESTful Web Services. JAX-RS is a Java-based programming language API and specification to provide support for created RESTful Web services. Java EE release includes Java API for RESTful Web services JAX-RS support, which provides a POJO-based framework to build lightweight Web services that conform to the REST style of software architecture. JAX-RS API which is part of JSR 311 offers several annotations that can be used to expose Java class methods as web resources. JAX-RS automatically translates between Java types and MIME media types. For example, if you mark a class method with annotation, produces media type text_plane, JAX-RS would translate the Java type to the text/plane MIME type, which represents plain text and return the content of that type in the http response to the client. The annotations add the information needed to identify resources and serve http requests. Some of the annotations supported by JAX-RS are path, get, post, produces, consumes.

JAX-RS also has other convenient features like parameter-based annotations that can be used to extract information from a request. One of these annotations is QueryParam, which can be used to extract query parameters from the query component of a request URL. Other parameter-based annotations are MatrixParam, which extracts information from URL path segments, HeaderParam which extracts information from http headers, and CookieParam which extracts information from the cookies declared in cookie related http headers. 

In the following videos, we will go over each annotation one by one. JAX-RS stands for Java API for RESTful Web services. JAX-RS is a Java-based programming language API, and specification to provide support for created RESTful web services. Its 2.0 version was released on the 24th of May 2013. JAX-RS uses annotations available from Java SC5 to simplify the development of Java-based web services creation and deployment. It also provides support for creating clients for RESTful Web services. The Java EE 6 release took the first step towards standardizing RESTful Web service APIs by introducing a Java API for RESTful Web services.

JAX-RS ensures the portability of REST API code across all Java EE compliant application servers. The other version is JAX-RS 2.0 which was released as part of the Java EE 7 platform. JAX-RS focuses on applying Java annotations to plain Java objects. JAX-RS has annotations to bind specific URI patterns and http operations to specific methods of your Java class. It also has annotations that can help you handle input-output parameters. Since JAX-RS is a specification, we must have its implementation to run REST API code. Some of the most popular JAX-RS implementations available today are Jersey, RESTEasy, Apache CXF, Restlet. Since these applications are not part of the exam subject matter, I won't go into detail about them. In the following video, I'd like to go over http request methods and response status codes in more detail. Following that, we will continue with annotations. See you in the next video.

 

About the Author
Students
413
Courses
35
Learning Paths
2

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics