Debian Codegraph @

src/docbkx/protocol/write.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 ~ Copyright 2009-2013 Roland Huss
4 ~
5 ~ Licensed under the Apache License, Version 2.0 (the "License");
6 ~ you may not use this file except in compliance with the License.
7 ~ You may obtain a copy of the License at
8 ~
9 ~ http://www.apache.org/licenses/LICENSE-2.0
10 ~
11 ~ Unless required by applicable law or agreed to in writing, software
12 ~ distributed under the License is distributed on an "AS IS" BASIS,
13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ~ See the License for the specific language governing permissions and
15 ~ limitations under the License.
16 -->
17
18 <section id="write">
19 <title>Writing attributes (write)</title>
20 <para>
21 Writing an attribute is quite similar to reading one, except that the request takes an
22 additional <constant>value</constant> element.
23 </para>
24 <section id="get-write">
25 <title>GET write request</title>
26 <para>
27 Writing an attribute wit an GET request, an URL with the following format has to be used:
28 <synopsis><![CDATA[<base url>/write/<mbean name>/<attribute name>/<value>/<inner path>]]></synopsis>
29 </para>
30 <table>
31 <title>GET Write Request</title>
32 <thead>
33 <tr>
34 <td>Part</td>
35 <td>Description</td>
36 <td>Example</td>
37 </tr>
38 </thead>
39 <tr>
40 <td><literal>&lt;mbean name&gt;</literal></td>
41 <td>MBean's ObjectName</td>
42 <td><literal>java.lang:type=ClassLoading</literal></td>
43 </tr>
44 <tr>
45 <td><literal>&lt;attribute name&gt;</literal></td>
46 <td>Name of attribute to set</td>
47 <td><literal>Verbose</literal></td>
48 </tr>
49 <tr>
50 <td><literal>&lt;value&gt;</literal></td>
51 <td>
52 The attribute name to value. The value must be serializable as described in
53 <xref linkend="serialization-request"/>.
54 </td>
55 <td><literal>true</literal></td>
56 </tr>
57 <tr>
58 <td><literal>&lt;path&gt;</literal></td>
59 <td>
60 Inner path for accessing the parent object on which to set the value.
61 (See also <xref linkend="paths"/>). Note, that this is
62 <emphasis>not</emphasis> the path to the attribute itself,
63 but to the object carrying this attribute. With a given
64 path it is possible to deeply set an value on a complex
65 object.
66 </td>
67 <td></td>
68 </tr>
69 </table>
70 <para>
71 For example, you can set the garbage collector to verbose mode by using
72 something like
73 <informalexample>
74 <literallayout class="monospaced">http://localhost:8080/jolokia/write/java.lang:type=Memory/Verbose/true</literallayout>
75 </informalexample>
76 </para>
77 </section>
78
79 <section id="post-write">
80 <title>POST write request</title>
81 <para>
82 The keys which are evaluated for a POST write request are:
83 </para>
84 <table>
85 <title>POST Write Request</title>
86 <thead>
87 <tr>
88 <td>Key</td>
89 <td>Description</td>
90 <td>Example</td>
91 </tr>
92 </thead>
93 <tr>
94 <td><constant>type</constant></td>
95 <td><emphasis role="bold">write</emphasis></td>
96 <td/>
97 </tr>
98 <tr>
99 <td><constant>mbean</constant></td>
100 <td>MBean's ObjectName</td>
101 <td><literal>java.lang:type=ClassLoading</literal></td>
102 </tr>
103 <tr>
104 <td><constant>attribute</constant></td>
105 <td>Name of attribute to set</td>
106 <td><literal>Verbose</literal></td>
107 </tr>
108 <tr>
109 <td><constant>value</constant></td>
110 <td>
111 The attribute name to value. The value must be serializable as described in
112 <xref linkend="serialization-request"/>.
113 </td>
114 <td><literal>true</literal></td>
115 </tr>
116 <tr>
117 <td><constant>path</constant></td>
118 <td>
119 An optional inner path for specifying an inner object on which to set the
120 value. See <xref linkend="paths"/> for more on inner paths.
121 </td>
122 <td></td>
123 </tr>
124 </table>
125 </section>
126
127 <section id="response-write">
128 <title>Write response</title>
129 <para>
130 As response for a write operation the old attribute's value is
131 returned. For a request
132 <synopsis><![CDATA[http://localhost:8080/jolokia/write/java.lang:type=ClassLoading/Verbose/true]]></synopsis>
133 you get the answer (supposed that verbose mode was switched
134 off for class loading at the time this request was sent)
135 </para>
136 <programlisting><![CDATA[
137 {
138 "value":"false",
139 "status":200,
140 "request": {
141 "mbean":"java.lang:type=ClassLoading",
142 "type":"write",
143 "attribute":"Verbose",
144 "value":true
145 }
146 }]]></programlisting>
147 <para>
148 The response is quite similar to the read operation except for
149 the additional <constant>value</constant> element in the request
150 (and of course, the different <constant>type</constant>).
151 </para>
152 </section>
153 </section>