1+ :imagesdir: ../images
2+
13[[json]]
24== Add Movie (Java API for JSON Processing)
35
@@ -50,11 +52,11 @@ this implementation will consume a JSON representation of the resource.
5052+
5153Make sure to resolve imports from the appropriate package as shown.
5254+
53- image::images/ 7.2-imports.png[title="Provider import"]
55+ image::7.2-imports.png[title="Provider import"]
5456+
5557. Make the class implements `MessageBodyReader<Movie>`.
5658+
57- image::images/ 7.3-implements.png[title="Implement abstract methods for MessageBodyReader"]
59+ image::7.3-implements.png[title="Implement abstract methods for MessageBodyReader"]
5860+
5961Click on the hint (shown as yellow bulb) on the class definition and
6062select `Implement all abstract methods'.
@@ -132,7 +134,7 @@ this implementation will produce a JSON representation of the resource.
132134+
133135Resolve the imports as shown.
134136+
135- image::images/ 7.6-imports.png[title="Provider import"]
137+ image::7.6-imports.png[title="Provider import"]
136138+
137139. Make this class implement `MessageBodyWriter` interface by adding the following code:
138140[source, java]
@@ -142,7 +144,7 @@ Resolve the imports.
142144+
143145The IDE provide a hint to implement abstract methods as:
144146+
145- image::images/ 7.7-implements.png[title="Implement abstract methods for MessageBodyWriter"]
147+ image::7.7-implements.png[title="Implement abstract methods for MessageBodyWriter"]
146148+
147149Click on the hint (show as yellow bulb) on the class definition and
148150select `Implement all abstract methods'.
@@ -230,7 +232,7 @@ then renders `movies.xhtml'.
230232Click on the hint (show as yellow bulb) to resolve the namespace
231233prefix/URI mapping as shown.
232234+
233- image::images/ 7.11-imports.png[title="Namespace prefix mapping imports"]
235+ image::7.11-imports.png[title="Namespace prefix mapping imports"]
234236+
235237. Add `movieName` and `actors` field to `MovieBackingBean` as:
236238+
@@ -273,17 +275,17 @@ the POJO to JSON. Media type of `application/json` is specified using `MediaType
273275+
274276Resolve the imports as shown
275277+
276- image::images/ 7.14-imports.png[title="Entity import"]
278+ image::7.14-imports.png[title="Entity import"]
277279+
278280. Run the project to see the updated main page as:
279281+
280- image::images/ 7.15-output.png[title="New Movie button"]
282+ image::7.15-output.png[title="New Movie button"]
281283+
282284A new movie can be added by clicking on `New Movie' button.
283285+
284286. Enter the details as shown:
285287+
286- image::images/ 7.16-output.png[title="Add a New Movie page"]
288+ image::7.16-output.png[title="Add a New Movie page"]
287289+
288290Click on `Add' button. The `Movie Id' value has to be greater than 20
289291otherwise the primary key constraint will be violated. The table
@@ -292,6 +294,6 @@ sequence; however this is not done in the application.
292294+
293295The updated page looks like as shown
294296+
295- image::images/ 7.16-output2.png[title="Newly added movie"]
297+ image::7.16-output2.png[title="Newly added movie"]
296298+
297299Note that the newly added movie is now displayed.
0 commit comments