JAX-RS Tutorial

jax-rs tutorials

Java API for RESTful Web Services (JAX-RS), is a set if APIs to developer REST service. JAX-RS is part of the Java EE6, and make developers to develop REST web application easily.

In this series of JAX-RS tutorials, we use both Jersey and RESTEasy, popular JAX-RS implementation.

Happy learning JAX-RS πŸ™‚

Quick Start

Some quick start examples to use JAX-RS.

Basic Examples

Basic annotations and functions to develop REST service.

File Upload Examples

How to handle multipart data in JAX-RS.

Working with XML

XML support in JAX-RS.

Working with JSON

JSON support in JAX-RS.

RESTful Java clients

Create a RESTful Java client to perform “GET” and “POST” request to manipulate json data.

JAX-RS + Spring

Integrate JAX-RS with Spring framework.

Common Error Messages

Some common error messages in JAX-RS development.

References

  1. Jersey official website
  2. Jersey user guide
  3. RESTEasy official website
  4. RESTEasy user guide
  5. REST explanation in Wiki

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
44 Comment threads
15 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
48 Comment authors
Nanda PRAHUL KARANJAVKJARGauravvahdetSamrat Roy Recent comment authors
newest oldest most voted
Samrat Roy
Guest
Samrat Roy

Hi Mkyong,
Thanks for your wonderful tutorials but i want to know about REST Filter using ContainerRequestFilter(jersey 1.9).
I have tried and googled it but didn’t able to find anything related to Jersey 1.9 , every1 is saying about jersey 2.X.
Please can you provide this in your JAX RS tutorials or any other user knows about it please comment below.

Karni Mohammed Fazil
Guest
Karni Mohammed Fazil

Where can I get the REST certification study material?

RAHUL KARANJAVKJAR
Guest
RAHUL KARANJAVKJAR

Thanks Mkyong..

ali ammar
Guest
ali ammar

Thanks πŸ™‚ You Are Awesome

Roop
Guest
Roop

Yong, could you please tell me, how can we handle/get form parameters in REST service when they are in quantity approx. 15 params?

I am aware about @FormParam annotation, but if we cover all the 15 parameters, the method signature become quit long or we can say not readable.

Is there any way ? so that we can directly populate the object based on said 15 form parameters.

I heard about an annotation @Form objRef, but it is no longer exists.

please provide your thoughts on this

thanks,
-Roop

Siregar
Guest
Siregar

Have you tutorial or example about restful in struts2?
Could you share it?

Siregar
Guest
Siregar

is there a tutorial about security in rest? I mean is like implementation of authentication to access resources.

Thank you.,

Milind Kadam
Guest
Milind Kadam

Hi Yong,

I am first timer for Web Services. Trying to implement RESTful web service using JAX-RS Jersey APIs. I need to design stateless as well as stateful APIs. I guess I have very good idea on designing stateless APIs but to implement stateful APIs I need to manage session and client state on server. I know REST does not recommend this but this is the application requirement. Any suggestions how to implement stateful APIs? Thanks in advance.

–Milind

Eduardo
Guest
Eduardo

Yong those are great tutorials… Thank You!!! Could you post a tutorial about using OAuth for authenticating RestFul Web Services ?? It would be highly appreciated.

Keep the good work!!!

trackback
Kari's World » Blog Archive » REST in pieces

[…] Update: 2.5.2012 Looks interesting: REST Endpoint for Integration Using Apache Camel JSR 311: JAX-RS: The JavaTM API for RESTful Web Services JAX-RS Tutorial […]

Ajay
Guest
Ajay

Need Help with @PUT and @DELETE type request and client for them..

Sajith
Guest
Sajith

Simple and really useful

Rocky
Guest
Rocky

Can you post how to do integration testing of Restful services without hard-coding the base URL (can be different for each environment)
DEV:8080/REST/TEST
UAT:8080/REST/TEST

trackback
Redshare – Eine Restful(le) Kontaktverwaltung…

[…] das Open-Source-Projekt Jersey. Mit Hilfe dieser Referenzimplementierung und den Tutorials von mkyong.com, lassen sich relativ leicht und schnell erste RESTful Webservices […]

gpsingh
Guest
gpsingh

good that works

trackback
REST | warrenburns

[…] now, if you are interested in some basic REST, check out http://www.mkyong.com/tutorials/jax-rs-tutorials/ or if you want to see some hardcore stuff on the topic of REST, check out apigee and how they […]

K E Naresh
Guest
K E Naresh

Please explain about the flow of execution jax-rs jersey application

Ravi
Guest
Ravi

Hi Thanks for the above example , Could you please share the code for Displaying the JSON into JSP Page

rafeeq
Guest
rafeeq

Can you please provide an example where a xml payload is sent through REST POST method preferably using spring resttemplate

Kwesi Aryee
Guest
Kwesi Aryee

An invaluable resource, very easy to understand.My first step into jax-rs has been really because of this tutorials

Amit Kumar
Guest
Amit Kumar

These examples are simple,tells you how RESTful Web Service work on basics.

Nirmal
Guest
Nirmal
sandip kandari
Guest
sandip kandari

How I can deploy Restfull web service on Apache tomcat server.
on web browser url if I write http://localhost:8080//index.jsp it display hello word.
but after writing http://localhost:8080/Energymeter/resources/generic1. it is giving servlet adapter exception

please tell me i can recover from this problem

Gnanasekaran Ebinezar
Guest
Gnanasekaran Ebinezar

Thanks a lot for your valable service to the IT Community.Whenever i want to learn any new things, i used to visit your site..Thanks a lot..

vijayakumar
Guest
vijayakumar

hi, i am a beginner i want to know the difference between web service and web application.. can u explain me in detail..

Aprajita
Guest
Aprajita

Thanks for your tutorials.
I have been following you for a very long time. It is always been very helpful and informative.

Aditya
Guest
Aditya

can you give the source code for Ejb + Jpa + Jsf + restful webservices.
I want to Insert data into Deployement Server Database using Restful Client

neha agrawal
Guest
neha agrawal

Hi MkYong,
Thanks for your tutorials!! They are really informative. I couldn’t find any tutorial on Exception/error handling in REST as well as SOAP web service. It would be nice if you can share some example on this subject.

Cheers,
Neha

qwangwei
Guest
qwangwei

if I can use hibernate in Resteasy, I want to use hibernate in my project

marlonlom
Guest
marlonlom

I have a quiestion… ΒΏis posible integtrate resteasy with stateless EJB’s, using @EJB Annotation?