Join Alex Theedom for an in-depth discussion in this video Solution: Add exception handlers, part of RESTful Service with JAX-RS 2.0.
(digital music)…- [Narrator] So how did you get along with this challenge?…Your challenge was to add error handlers where appropriate.…Now your solution might differ slightly from mine.…So I'm just going to show you what I did.…Here in the older class, I decided I wanted to throw…an AuthorIDNotRecognizedException,…if an ID was passed into the getAuthor method…that was not recognized.…So what I had to do was to create…an AuthorIDNotRecognizedException,…and here in the getAuthor method,…all I've had to do is throw that exception,…and also what I need to do is…to create an exception manager.…
So I'll open up the Exception Manager…and show you what that looks like.…So here in the Exception Manager,…all I've done is to create…an AuthorIDNotRecognizedExceptionManager…and implement the Exception Manager interface.…And I've passed into that the exception…that I want it to handle.…I've implemented the method to response,…and within that method, all I'm doing is…I'm responding back to the client…with a NO_CONTENT response.…
Author
Released
6/5/2017Join Alex Theedom as he guides you through a wide range of topics, including how to define resource endpoints, how to add dynamism to your application with hypermedia, how to maintain data integrity with Bean Validation, and how to process messages with the JSON Processing API. Once you have completed this course, you'll be ready to develop your own client and server RESTful APIs.
- Discover the extent of JAX-RS's features
- Use the annotation methodology
- Use the inheritance methodology
- Define a REST contract and API root
- Create the REST resource entity
- Create the REST resource methods
- Understand consumers and producers
- Work with different media types
- Define and work with path parameters
- Build a REST response and handle exceptions
- Implement Bean Validation and manage failures
- Create a RESTful client that consumes the web service
- Use JSON-P API with the REST client
- Implement hypermedia (HATEOAS)
Skill Level Intermediate
Duration
Views
Related Courses
-
JSON Processing with Java EE
with Alex Theedom1h 4m Intermediate -
WebSocket Programming with Java EE
with Alex Theedom1h 29m Intermediate -
Java EE: Web Services
with Patrick Royal2h 25m Intermediate
-
Introduction
-
Welcome53s
-
What you should know1m 47s
-
Challenges39s
-
-
1. JAX-RS 2.0
-
JAX-RS 2.0 introduction1m 19s
-
REST introduction2m 22s
-
-
2. Introduction to Bookshop Application
-
Bookshop application demo3m 47s
-
Deployment demo2m 20s
-
-
3. Create a REST Resource
-
Define the REST contract3m 42s
-
Define the API root3m 14s
-
Create the resource entity5m 37s
-
Create the resource methods6m 16s
-
Path parameters2m 35s
-
Add path paramaters3m 21s
-
@Consumes and @Produces2m 7s
-
Add the media types4m 56s
-
-
4. Responses and HATEOAS
-
The HTTP response4m 24s
-
Build a response3m 24s
-
How to handle errors3m 19s
-
Work with HATEOAS4m 21s
-
HATEOAS and JAX-RS2m 59s
-
Add HATEOAS to the resource10m 33s
-
-
5. Bean Validation API
-
Bean Validation introduction2m 10s
-
Work with Bean Validation6m 41s
-
-
6. Create a REST Client
-
Make a request3m 3s
-
Implement a client5m 15s
-
Use JSONP8m 24s
-
Implement HATEOAS8m 47s
-
-
Conclusion
-
Next steps1m 20s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Solution: Add exception handlers