Skip to content

Commit 2641b4a

Browse files
committed
updated 2018!
updated spaces
1 parent 88b8eec commit 2641b4a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

java-servlet-json/src/main/java/com/hmkcode/JSONServlet.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
3838
}
3939

4040
// 2. initiate jackson mapper
41-
ObjectMapper mapper = new ObjectMapper();
41+
ObjectMapper mapper = new ObjectMapper();
4242

43-
// 3. Convert received JSON to Article
44-
Article article = mapper.readValue(json, Article.class);
43+
// 3. Convert received JSON to Article
44+
Article article = mapper.readValue(json, Article.class);
4545

4646
// 4. Set response type to JSON
4747
response.setContentType("application/json");
4848

49-
// 5. Add article to List<Article>
49+
// 5. Add article to List<Article>
5050
articles.add(article);
5151

5252
// 6. Send List<Article> as JSON to client
53-
mapper.writeValue(response.getOutputStream(), articles);
53+
mapper.writeValue(response.getOutputStream(), articles);
5454
}
5555
}

0 commit comments

Comments
 (0)