File: Yaml.xml

package info (click to toggle)
resteasy 3.6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,612 kB
  • sloc: java: 265,492; xml: 27,855; javascript: 405; jsp: 166; python: 101; sh: 15; sql: 3; makefile: 2
file content (110 lines) | stat: -rwxr-xr-x 2,417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<chapter id="Built_in_YAML_Provider">
   <title>YAML Provider</title>

   <para>

      RESTEasy comes with built in support for YAML using the SnakeYAML library. To enable YAML support,
      you need to drop in the SnakeYaml 1.8 jar and the resteasy-yaml-provider.jar (whatever the current version is) in RestEASY's classpath.
      Then you need to manually register the org.jboss.resteasy.plugins.providers.YamlProvider provider. Note this feature is currently
      deprecated due to security vulnerabilities and will likely be removed in the future.
   </para>
   <para>


   </para>
   <para>

      SnakeYaml jar file can either be downloaded from Google code at
       http://code.google.com/p/snakeyaml/downloads/list
   </para>
   <para>

      Or if you use maven, the SnakeYaml jar is available through SonaType public repositories and included using this
      dependency:
   </para>
   <para>

 <programlisting>
 &lt;dependency&gt;
&lt;groupId&gt;org.yaml&lt;/groupId&gt;
&lt;artifactId&gt;snakeyaml&lt;/artifactId&gt;
&lt;version&gt;1.8&lt;/version&gt;
 &lt;/dependency&gt;
      </programlisting>
   </para>
   <para>

      When starting resteasy look out in the logs for a line stating that the YamlProvider has been added - this
      indicates that resteasy has found the Jyaml jar:
   </para>
   <para>

      2877 Main INFO org.jboss.resteasy.plugins.providers.RegisterBuiltin - Adding YamlProvider
   </para>
   <para>


   </para>
   <para>

      The Yaml provider recognises three mime types:
   </para>
   <para>

      <itemizedlist>

         <listitem>
            text/x-yaml
         </listitem>

         <listitem>
            text/yaml
         </listitem>

         <listitem>
            application/x-yaml
         </listitem>

      </itemizedlist>

   </para>
   <para>


   </para>
   <para>

      This is an example of how to use Yaml in a resource method.
   </para>
   <para>

 <programlisting>
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;

 @Path("/yaml")
 public class YamlResource
 {

@GET
@Produces("text/x-yaml")
public MyObject getMyObject() {
   return createMyObject();
}
...
 }
 </programlisting>
   </para>
   <para>

   </para>
   <para>

   </para>
   <para>


   </para>
</chapter>