From the course: Jakarta Web Services
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Media types in action - Jakarta EE Tutorial
From the course: Jakarta Web Services
Media types in action
- [Instructor] Let's first start by inspecting a REST endpoint and see what the HTTP response headers look like. In my REST client, I have this endpoint. If I inspect the headers for this endpoint, you can see the response headers like this. Let's go to headers. Notice the Content-Type response header. It has a value of application/json. This means that this REST endpoint returns the requested resource in JSON format. Notice that I have not declared the media types acceptable for the resource method getFlightsByAirline to return using the @Producers annotation. However, since my return Java type is a list of flight objects, in the absence of the annotation, it is mapped by the message body writer to the response entity in JSON format. That's because Jakarta REST determines that it's the applicable media type for the content returned and this is why you saw the Content-Type as application/json. Let's look at this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Implement resource method for reading: HTTP GET7m 52s
-
(Locked)
Use path parameters4m 28s
-
(Locked)
Use query parameters3m 54s
-
(Locked)
Explore response value types: Media types3m 40s
-
(Locked)
Media types in action5m 10s
-
(Locked)
ResponseBuilder and methods3m 4s
-
(Locked)
Control the response via ResponseBuilder7m 6s
-
(Locked)
Challenge: Travel app2m 23s
-
(Locked)
Solution: Travel app4m 54s
-
-
-
-
-