Skip to content

Commit 8c771c5

Browse files
committed
Merge pull request #6 from decebals/jackson
Add pippo-jackson to ContentTypeEngines document
2 parents 3535f2e + 00ec0d9 commit 8c771c5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

_posts/2015-04-02-content-types.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ order: 55
99
When we send a Response to the client we must specify the content type. In most cases the content type is __html__ (`text/html`) but are situations (for example a REST application/module)
1010
when we want to return __plain text__ (`text/plain`) or __json__ (`application/json`) or __xml__ (`application/xml`) or __yaml__ (`application/x-yaml`).
1111
To resolve these situations Pippo comes with a nice concept [ContentTypeEngine]({{ site.coreurl }}/src/main/java/ro/pippo/core/ContentTypeEngine.java).
12-
Pippo comes bultin (direct or via modules) with the following content type engines:
12+
Pippo comes bultin (direct or via modules) with the following content type engines:
1313

1414
- plain text ([TextPlainEngine]({{ site.coreurl }}/src/main/java/ro/pippo/core/TextPlainEngine.java))
1515
- xml ([JaxbEngine]({{ site.coreurl }}/src/main/java/ro/pippo/core/JaxbEngine.java), [XstreamEngine]({{ site.codeurl }}/pippo-xstream/src/main/java/ro/pippo/xstream/XstreamEngine.java))
16-
- json ([GsonEngine]({{ site.codeurl }}/pippo-gson/src/main/java/ro/pippo/gson/GsonEngine.java), [FastjsonEngine]({{ site.codeurl }}/pippo-fastjson/src/main/java/ro/pippo/fastjson/FastjsonEngine.java))
16+
- json ([GsonEngine]({{ site.codeurl }}/pippo-gson/src/main/java/ro/pippo/gson/GsonEngine.java), [FastjsonEngine]({{ site.codeurl }}/pippo-fastjson/src/main/java/ro/pippo/fastjson/FastjsonEngine.java), [JacksonEngine]({{ site.codeurl }}/pippo-jackson/src/main/java/ro/pippo/jackson/JacksonEngine.java))
1717
- yaml ([SnakeYamlEngine]({{ site.codeurl }}/pippo-snakeyaml/src/main/java/ro/pippo/snakeyaml/SnakeYamlEngine.java))
1818

1919
If you want to develop a new engine of content type you can do it very easily. All you have to do is to implement ContentTypeEngine.
@@ -51,7 +51,7 @@ To register a content type engine in your application you have two options:
5151
- add programatically the content type engine in `Application.onInit()` with `Application.registerContentTypeEngine(XstreamEngine.class)`
5252
- create an [Initializer]({{ site.coreurl }}/src/main/java/ro/pippo/core/Initializer.java) in your project that register the content type engine
5353

54-
For above _XstreamEngine_ we can create an _XstreamInitializer_ with this possible content:
54+
For above _XstreamEngine_ we can create an _XstreamInitializer_ with this possible content:
5555

5656
```java
5757
public class XstreamInitializer implements Initializer {
@@ -88,9 +88,9 @@ public class BasicApplication extends Application {
8888
.setId(12345)
8989
.setName("John")
9090
.setPhone("0733434435")
91-
.setAddress("Sunflower Street, No. 6");
91+
.setAddress("Sunflower Street, No. 6");
9292
}
93-
93+
9494
}
9595
```
9696

@@ -100,7 +100,7 @@ header may also be used if an agreeable content type engine can not be determine
100100
If no Content-Type can not be negotiated then the response will not be modified. This behavior allows specification of a default Content-Type
101101
using one of the methods such as `xml()` or `json()`.
102102

103-
See below an example related to content type negotiation:
103+
See below an example related to content type negotiation:
104104

105105
```java
106106
public class BasicApplication extends Application {
@@ -120,4 +120,3 @@ public class BasicApplication extends Application {
120120
In above example `routeContext.xml().negotiateContentType().send(contact)` would set the default Content-Type as `application/xml` and
121121
then attempt to negotiate the client's preferred type. If negotiation failed, then the default `application/xml` would be sent and used to
122122
serialize the outgoing object.
123-

0 commit comments

Comments
 (0)