@@ -50,19 +50,19 @@ Raw `request body` is available via javadoc:Context[body] method:
5050
5151This give us the `raw body` .
5252
53- ==== Parser
53+ ==== Message Decoder
5454
55- Request body parsing is achieved using the javadoc:Parser [] functional interface.
55+ Request body parsing is achieved using the javadoc:MessageDecoder [] functional interface.
5656
5757[source, java]
5858----
59- public interface Parser {
59+ public interface MessageDecoder {
6060
6161 <T> T parse(Context ctx, Type type) throws Exception;
6262}
6363----
6464
65- javadoc:Parser [] has a single `parse` method that takes two input arguments: `(context, type)`
65+ javadoc:MessageDecoder [] has a single `parse` method that takes two input arguments: `(context, type)`
6666and returns a single result of the given type.
6767
6868.JSON example:
@@ -71,7 +71,7 @@ and returns a single result of the given type.
7171{
7272 FavoriteJson lib = new FavoriteJson(); // <1>
7373
74- parser (MediaType.json, (ctx, type) -> { // <2>
74+ decoder (MediaType.json, (ctx, type) -> { // <2>
7575
7676 byte[] body = ctx.body().bytes(); // <3>
7777
@@ -90,7 +90,7 @@ and returns a single result of the given type.
9090{
9191 val lib = FavoriteJson() // <1>
9292
93- parser (MediaType.json, { ctx, type -> // <2>
93+ decoder (MediaType.json, { ctx, type -> // <2>
9494
9595 val body = ctx.body().bytes() // <3>
9696
@@ -107,12 +107,12 @@ and returns a single result of the given type.
107107<2> Check if the `Content-Type` header matches `application/json`
108108<3> Ready the body as `byte[]`
109109<4> Parse the `body` and use the requested type
110- <5> Route handler now call the `body(Type)` function to trigger the parser function
110+ <5> Route handler now call the `body(Type)` function to trigger the decoder function
111111
112112[TIP]
113113====
114114
115- Jooby comes with a `json` parser built on top of https://github.com/FasterXML/jackson-databind[Jackson]:
115+ Jooby comes with a `json` decoder built on top of https://github.com/FasterXML/jackson-databind[Jackson]:
116116
117117[dependency, artifactId="jooby-jackson"]
118118.
0 commit comments