You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/02/15 20:50:41 UTC
[2/8] incubator-juneau git commit: Modification to UON spec. Remove
bean subtype support.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html b/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
index d75d638..35f591c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/urlencoding/package.html
@@ -137,7 +137,68 @@
<p>
By appending <code>?Accept=application/x-www-form-urlencoded&plainText=true</code> to the URL, you can view the data as a URL-encoded string:
</p>
- <img class='bordered' src="doc-files/Example_UrlEncoding.png">
+ <p class='bcode'>
+ <un>0</un>=(
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/people/1</us>,
+ <ua>addressBookUri</ua>=<us>http://localhost:10000/addressBook/</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>name</ua>=<us>'Barack+Obama'</us>,
+ <ua>birthDate</ua>=<us>'Aug+4,+1961'</us>,
+ <ua>addresses</ua>=@(
+ (
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/addresses/1</us>,
+ <ua>personUri</ua>=<us>http://localhost:10000/addressBook/people/1</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>street</ua>=<us>'1600+Pennsylvania+Ave'</us>,
+ <ua>city</ua>=<us>Washington</us>,
+ <ua>state</ua>=<us>DC</us>,
+ <ua>zip</ua>=<un>20500</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
+ ),
+ (
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/addresses/2</us>,
+ <ua>personUri</ua>=<us>http://localhost:10000/addressBook/people/1</us>,
+ <ua>id</ua>=<un>2</un>,
+ <ua>street</ua>=<us>'5046+S+Greenwood+Ave'</us>,
+ <ua>city</ua>=<us>Chicago</us>,
+ <ua>state</ua>=<us>IL</us>,
+ <ua>zip</ua>=<un>60615</un>,
+ <ua>isCurrent</ua>=<uk>false</uk>
+ )
+ ),
+ <ua>age</ua>=<un>56</un>
+ )
+ &<un>1</un>=(
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/people/2</us>,
+ <ua>addressBookUri</ua>=<us>http://localhost:10000/addressBook/</us>,
+ <ua>id</ua>=<un>2</un>,
+ <ua>name</ua>=<us>'George+Walker+Bush'</us>,
+ <ua>birthDate</ua>=<us>'Jul+6,+1946'</us>,
+ <ua>addresses</ua>=@(
+ (
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/addresses/3</us>,
+ <ua>personUri</ua>=<us>http://localhost:10000/addressBook/people/2</us>,
+ <ua>id</ua>=<un>3</un>,
+ <ua>street</ua>=<us>'43+Prairie+Chapel+Rd'</us>,
+ <ua>city</ua>=<us>Crawford</us>,
+ <ua>state</ua>=<us>TX</us>,
+ <ua>zip</ua>=<un>76638</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
+ ),
+ (
+ <ua>uri</ua>=<us>http://localhost:10000/addressBook/addresses/4</us>,
+ <ua>personUri</ua>=<us>http://localhost:10000/addressBook/people/2</us>,
+ <ua>id</ua>=<un>4</un>,
+ <ua>street</ua>=<us>'1600+Pennsylvania+Ave'</us>,
+ <ua>city</ua>=<us>Washington</us>,
+ <ua>state</ua>=<us>DC</us>,
+ <ua>zip</ua>=<un><us>20500</un>,
+ <ua>isCurrent</ua>=<uk>false</uk>
+ )
+ ),
+ <ua>age</ua>=<un>71</un>
+ )
+ </p>
<p>
Juneau supports two kinds of serialization:
@@ -150,64 +211,77 @@
Top-level beans and maps can serialized as key/value pairs as shown below:
</p>
<h6 class='figure'>Example: A bean with 2 string properties, 'foo' and 'baz', serialized to a query string</h6>
- <p class='bcode'> http://localhost/sample?<xa>foo</xa>=<xs>bar</xs>&<xa>baz</xa>=<xs>bing</xs></p>
+ <p class='bcode'>
+ http://localhost/sample?<ua>foo</ua>=<us>bar</us>&<ua>baz</ua>=<us>bing</us>
+ </p>
<p>
- Lower-level beans and maps are also serialized as key/value pairs, but are surrounded with a <js>"$o(...)"</js> construct to denote an object mapping,
+ Lower-level beans and maps are also serialized as key/value pairs, but are surrounded with a <js>"(...)"</js> construct to denote an object mapping,
and uses a comma as the parameter delimiter instead of <js>"&"</js>.<br>
</p>
<h6 class='figure'>Example: A bean serialized as a query parameter value.</h6>
- <p class='bcode'> http://localhost/sample?<xa>a1</xa>=$o(<xa>foo</xa>=<xs>bar</xs>,<xa>baz</xa>=<xs>bing</xs>)</p>
- <p>
- The UON specification defines two separate modes:
+ <p class='bcode'>
+ http://localhost/sample?<ua>a1</ua>=(<ua>foo</ua>=<us>bar</us>,<ua>baz</ua>=<us>bing</us>)
</p>
- <ul class='spaced-list'>
- <li>Strict mode - Serialized model is fully equivalent to JSON and can be losslessly converted back and forth into a JSON model without additional information.
- <li>Lax mode - A shortened form that excludes data type information. Ideal if the data types of values are fixed and already known by the parser.
- </ul>
+
+ <h6 class='figure'>General methodology:</h6>
<table class='styled' style='border-collapse: collapse;'>
- <tr><th>Java type</th><th>JSON equivalent</th><th>Strict syntax</th><th>Lax syntax</th></tr>
+ <tr><th>Java type</th><th>JSON equivalent</th><th>UON</th></tr>
<tr>
<td>Maps/beans</td>
<td>OBJECT</td>
- <td class='code'><xa>a1</xa>=$o(<xa>b1</xa>=<xs>x1</xs>,<xa>b2</xa>=<xs>x2</xs>)<br><xa>a1</xa>=$o(<xa>b1</xa>=$o(<xa>c1</xa>=<xs>x1</xs>,<xa>c2</xa>=<xs>x2</xs>))</td>
- <td class='code'><xa>a1</xa>=(<xa>b1</xa>=<xs>x1</xs>,<xa>b2</xa>=<xs>x2</xs>)<br><xa>a1</xa>=(<xa>b1</xa>=(<xa>c1</xa>=<xs>x1</xs>,<xa>c2</xa>=<xs>x2</xs>))</td>
+ <td class='code'>
+ <ua>a1</ua>=(<ua>b1</ua>=<us>x1</us>,<ua>b2</ua>=<us>x2</us>)
+ <ua>a1</ua>=(<ua>b1</ua>=(<ua>c1</ua>=<us>x1</us>,<ua>c2</ua>=<us>x2</us>))
+ </td>
</tr>
<tr>
<td>Collections/arrays</td>
<td>ARRAY</td>
- <td class='code'><xa>a1</xa>=$a(<xs>x1</xs>,<xs>x2</xs>)<br><xa>a1</xa>=$a($a(<xs>x1</xs>,<xs>x2</xs>),$a(<xs>x3</xs>,<xs>x4</xs>))<br><xa>a1</xa>=$a($o(<xa>b1</xa>=<xs>x1</xs>,<xa>b2</xa>=<xs>x2</xs>),$o(<xa>c1</xa>=<xs>x1</xs>,<xa>c2</xa>=<xs>x2</xs>))</td>
- <td class='code'><xa>a1</xa>=(<xs>x1</xs>,<xs>x2</xs>)<br><xa>a1</xa>=((<xs>x1</xs>,<xs>x2</xs>),(<xs>x3</xs>,<xs>x4</xs>))<br><xa>a1</xa>=((<xa>b1</xa>=<xs>x1</xs>,<xa>b2</xa>=<xs>x2</xs>),(<xa>c1</xa>=<xs>x1</xs>,<xa>c2</xa>=<xs>x2</xs>))</td>
+ <td class='code'>
+ <ua>a1</ua>=@(<us>x1</us>,<us>x2</us>)
+ <ua>a1</ua>=@(@(<us>x1</us>,<us>x2</us>),@(<us>x3</us>,<us>x4</us>))
+ <ua>a1</ua>=@((<ua>b1</ua>=<us>x1</us>,<ua>b2</ua>=<us>x2</us>),(<ua>c1</ua>=<us>x1</us>,<ua>c2</ua>=<us>x2</us>))
+ </td>
</tr>
<tr>
<td>Booleans</td>
<td>BOOLEAN</td>
- <td class='code'><xa>a1</xa>=$b(<xs>true</xs>)&<xa>a2</xa>=$b(<xs>false</xs>)</td>
- <td class='code'><xa>a1</xa>=<xs>true</xs>&<xa>a2</xa>=<xs>false</xs></td>
+ <td class='code'>
+ <ua>a1</ua>=<uk>true</uk>&<ua>a2</ua>=<uk>false</uk>
+ </td>
</tr>
<tr>
<td>int/float/double/...</td>
<td>NUMBER</td>
- <td class='code'><xa>a1</xa>=$n(<xs>123</xs>)&<xa>a2</xa>=$n(<xs>1.23e1</xs>)</td>
- <td class='code'><xa>a1</xa>=<xs>123</xs>&<xa>a2</xa>=<xs>1.23e1</xs></td>
+ <td class='code'>
+ <ua>a1</ua>=<un>123</un>&<ua>a2</ua>=<un>1.23e1</un>
+ </td>
</tr>
<tr>
<td>null</td>
<td>NULL</td>
- <td class='code'><xa>a1</xa>=<xs>%00</xs></td>
- <td class='code'><xa>a1</xa>=<xs>%00</xs></td>
+ <td class='code'>
+ <ua>a1</ua>=<uk>null</uk>
+ </td>
</tr>
<tr>
<td>String</td>
<td>STRING</td>
- <td class='code'><xa>a1</xa>=<xs>foobar</xs></td>
- <td class='code'><xa>a1</xa>=<xs>foobar</xs></td>
+ <td class='code'>
+ <ua>a1</ua>=<us>foobar</us>
+ <ua>a1</ua>=<us>'true'</us>
+ <ua>a1</ua>=<us>'null'</us>
+ <ua>a1</ua>=<us>'123'</us>
+ <ua>a1</ua>=<us>' string with whitespace '</us>
+ <ua>a1</ua>=<us>'string with ~'escaped~' quotes'</us>
+ </td>
</tr>
</table>
<p>
Refer to the <a href='doc-files/rfc_uon.txt'>UON specification</a> for a complete set of syntax rules.
<p>
<code>PojoSwaps</code> can be used to convert non-serializable POJOs into serializable forms, such as converting
- <code>Calendar</code> object to ISO8601 strings, or <code><jk>byte</jk>[]</code> arrays to Base-64 encoded strings.<br>
+ <code>Calendar</code> object to ISO8601 strings, or <code><uk>byte</uk>[]</code> arrays to Base-64 encoded strings.<br>
These transforms can be associated at various levels:
</p>
<ul class='spaced-list'>
@@ -216,7 +290,9 @@
<li>On bean properties through the <code><ja>@BeanProperty</ja></code> annotations.
</ul>
<h6 class='figure'>Example: A serialized Calendar object using <code>CalendarSwap.RFC2822DTZ</code> transform.</h6>
- <p class='bcode'> http://localhost/sample?<xa>a1=<js>Sun~,+03+Mar+1901+09:05:06+GMT</js></p>
+ <p class='bcode'>
+ http://localhost/sample?<ua>a1=<us>'Sun,+03+Mar+1901+09:05:06+GMT'</us>
+ </p>
<p>
For more information about transforms, refer to {@link org.apache.juneau.transform}.
</p>
@@ -241,23 +317,15 @@
</p>
<ul class='spaced-list'>
<li>{@link org.apache.juneau.urlencoding.UrlEncodingSerializer#DEFAULT} - All default settings, strict mode.
- <li>{@link org.apache.juneau.urlencoding.UrlEncodingSerializer#DEFAULT_SIMPLE} - All default settings, lax mode.
<li>{@link org.apache.juneau.urlencoding.UrlEncodingSerializer#DEFAULT_READABLE} - Use whitespace and indentation for readability.
<li>{@link org.apache.juneau.urlencoding.UonSerializer#DEFAULT} - All default settings, strict mode.
- <li>{@link org.apache.juneau.urlencoding.UonSerializer#DEFAULT_SIMPLE} - All default settings, lax mode.
<li>{@link org.apache.juneau.urlencoding.UonSerializer#DEFAULT_READABLE} - Use whitespace and indentation for readability.
<li>{@link org.apache.juneau.urlencoding.UonSerializer#DEFAULT_ENCODING} - Same as DEFAULT, but use URL-Encoding on special characters.
- <li>{@link org.apache.juneau.urlencoding.UonSerializer#DEFAULT_SIMPLE_ENCODING} - Same as DEFAULT_SIMPLE, but use URL-Encoding on special characters.
</ul>
<p>
The general guidelines on which serializer to use is:
</p>
<ul class='spaced-list'>
- <li>Use strict mode serializers if the data types of the value are not known on the parsing side, and this
- information needs to be preserved during transmission.
- <li>Use lax mode serializers if the data types of the value are known on the parsing side.
- For example, if you're serializing/parsing beans, lax mode is usually sufficient since the data types
- can be inferred from the bean properties.
<li>Use encoding serializers when you're using the results to construct a URI yourself, and therefore
need invalid URI characters to be encoded.
<li>Use unencoding serializers when you're creating parameter values and passing them off to some other
@@ -298,7 +366,7 @@
UonSerializer s = UonSerializer.<jsf>DEFAULT</jsf>;
<jc>// Create our bean.</jc>
- Person p = <jk>new</jk> Person(1, <js>"John Smith"</js>);
+ Person p = <uk>new</uk> Person(1, <js>"John Smith"</js>);
<jc>// Serialize the bean to URL-encoded parameter value.</jc>
String urlencoded = s.serialize(p);
@@ -307,7 +375,7 @@
The code above produces the following output:
</p>
<p class='bcode'>
- $o(<xa>id</xa>=$n(<xs>1</xs>),<xa>name</xa>=<xs>John+Smith</xs>)
+ (<ua>id</ua>=<un>1</un>,<ua>name</ua>=<us>'John+Smith'</us>)
</p>
<p>
The {@link org.apache.juneau.urlencoding.UrlEncodingSerializer} class converts
@@ -324,16 +392,9 @@
The code above produces the following output:
</p>
<p class='bcode'>
- <xa>id</xa>=$n(<xs>1</xs>)&<xa>name</xa>=<xs>John+Smith</xs>
+ <ua>id</ua>=<un>1</un>&<ua>name</ua>=<us>'John+Smith'</us>
</p>
<p>
- The general method guidelines are as follows:
- </p>
- <ul class='spaced-list'>
- <li>Use <code>UonSerializer</code> to create individual query parameter values.
- <li>Use <code>UrlEncodingSerializer</code> to create complete URL-encoded query strings.
- </ul>
- <p>
By default, the <code>UrlEncodingSerializer</code> class will URL-Encode special characters, and the <code>UonSerializer</code> will NOT URL-encode special characters.
</p>
@@ -370,7 +431,6 @@
<ja>@BeanProperty</ja>(swap=CalendarSwap.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar <jf>birthDate</jf>;
-
<jc>// Bean constructor (needed by parser)</jc>
<jk>public</jk> Person() {}
@@ -396,13 +456,13 @@
Now when we rerun the sample code, we'll get the following:
</p>
<p class='bcode'>
- $o(<xa>id</xa>=$n(<xs>1</xs>),<xa>name</xa>=<xs>John+Smith</xs>,<xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,<xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>,<xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>)
+ (<ua>id</ua>=<un>1</un>,<ua>name</ua>=<us>'John+Smith'</us>,<ua>uri</ua>=<us>http://sample/addressBook/person/1</us>,<ua>addressBookUri</ua>=<us>http://sample/addressBook</us>,<ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>)
</p>
<p>
Using <code>UrlEncodingSerializer</code> instead would create the following:
</p>
<p class='bcode'>
- <xa>id</xa>=$n(<xs>1</xs>)&<xa>name</xa>=<xs>John+Smith</xs>&<xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>&<xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>&<xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>
+ <ua>id</ua>=<un>1</un>&<ua>name</ua>=<us>'John+Smith'</us>&<ua>uri</ua>=<us>http://sample/addressBook/person/1</us>&<ua>addressBookUri</ua>=<us>http://sample/addressBook</us>&<ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>
</p>
<p>
Another useful feature is the {@link org.apache.juneau.annotation.Bean#propertyNamer()} annotation that allows you to plug in your own
@@ -418,7 +478,7 @@
</p>
<h6 class='figure'>Results</h6>
<p class='bcode'>
- $o(<xa>id</xa>=$n(<xs>1</xs>),<xa>name</xa>=<xs>John+Smith</xs>,<xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,<xa>address-book-uri</xa>=<xs>http://sample/addressBook</xs>,<xa>birth-date</xa>=<xs>1946-08-12T00:00:00Z</xs>)
+ (<ua>id</ua>=<un>1</us>,<ua>name</ua>=<us>'John+Smith'</us>,<ua>uri</ua>=<us>http://sample/addressBook/person/1</us>,<ua>address-book-uri</ua>=<us>http://sample/addressBook</us>,<ua>birth-date</ua>=<us>1946-08-12T00:00:00Z</us>)
</p>
</div>
@@ -477,73 +537,45 @@
Now when we run the sample code, we get the following (in readable format):
</p>
<p class='bcode'>
- $o(
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>name</xa>=<xs>John+Smith</xs>,
- <xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>,
- <xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>,
- <xa>addresses</xa>=$a(
- $o(
- <xa>uri</xa>=<xs>http://sample/addressBook/address/1</xs>,
- <xa>personUri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>street</xa>=<xs>100+Main+Street</xs>,
- <xa>city</xa>=<xs>Anywhereville</xs>,
- <xa>state</xa>=<xs>NY</xs>,
- <xa>zip</xa>=$n(<xs>12345</xs>),
- <xa>isCurrent</xa>=$b(<xs>true</xs>)
- )
- )
- )
- </p>
- <p>
- If we were to use lax mode instead, we would get the following:
- </p>
- <p class='bcode'>
(
- <xa>id</xa>=<xs>1</xs>,
- <xa>name</xa>=<xs>John+Smith</xs>,
- <xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>,
- <xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>,
- <xa>addresses</xa>=(
+ <ua>id</ua>=<un>1</un>,
+ <ua>name</ua>=<us>'John+Smith'</us>,
+ <ua>uri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>addressBookUri</ua>=<us>http://sample/addressBook</us>,
+ <ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>,
+ <ua>addresses</ua>=@(
(
- <xa>uri</xa>=<xs>http://sample/addressBook/address/1</xs>,
- <xa>personUri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>id</xa>=<xs>1</xs>,
- <xa>street</xa>=<xs>100+Main+Street</xs>,
- <xa>city</xa>=<xs>Anywhereville</xs>,
- <xa>state</xa>=<xs>NY</xs>,
- <xa>zip</xa>=<xs>12345</xs>,
- <xa>isCurrent</xa>=<xs>true</xs>
+ <ua>uri</ua>=<us>http://sample/addressBook/address/1</us>,
+ <ua>personUri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>street</ua>=<us>'100+Main+Street'</us>,
+ <ua>city</ua>=<us>Anywhereville</us>,
+ <ua>state</ua>=<us>NY</us>,
+ <ua>zip</ua>=<un>12345</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
)
)
)
</p>
<p>
- Note how the data type information is removed, so it's not possible to distinguish between numbers/booleans/strings, and between objects/arrays.
- However, this is fine if we're parsing back into the same beans, since we can inver the data types from the bean property metadata.
- </p>
- <p>
If we were to use <code>UrlEncodingSerializer</code> instead, we would get the following:
</p>
<p class='bcode'>
- <xa>id</xa>=$n(<xs>1</xs>)&
- <xa>name</xa>=<xs>John+Smith</xs>&
- <xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>&
- <xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>&
- <xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>&
- <xa>addresses</xa>=$a(
- $o(
- <xa>uri</xa>=<xs>http://sample/addressBook/address/1</xs>,
- <xa>personUri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>street</xa>=<xs>100+Main+Street</xs>,
- <xa>city</xa>=<xs>Anywhereville</xs>,
- <xa>state</xa>=<xs>NY</xs>,
- <xa>zip</xa>=$n(<xs>12345</xs>),
- <xa>isCurrent</xa>=$b(<xs>true</xs>)
+ <ua>id</ua>=<un>1</un>&
+ <ua>name</ua>=<us>'John+Smith'</us>&
+ <ua>uri</ua>=<us>http://sample/addressBook/person/1</us>&
+ <ua>addressBookUri</ua>=<us>http://sample/addressBook</us>&
+ <ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>&
+ <ua>addresses</ua>=@(
+ (
+ <ua>uri</ua>=<us>http://sample/addressBook/address/1</us>,
+ <ua>personUri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>street</ua>=<us>'100+Main+Street'</us>,
+ <ua>city</ua>=<us>Anywhereville</us>,
+ <ua>state</ua>=<us>NY</us>,
+ <ua>zip</ua>=<un>12345</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
)
)
</p>
@@ -552,8 +584,6 @@
Note how the top level <code>Person</code> bean is serialized using the standard <js>'&'</js> delimiter, whereas the lower-level <code>Address</code>
bean is serialized using the <js>','</js> character to prevent the <code>addresses</code> field from being incompletely parsed.
</p>
-
-
<!-- ======================================================================================================== -->
@@ -608,9 +638,9 @@
What we end up with is the following, which does not serialize the contents of the <code>c</code> field:
</p>
<p class='bcode'>
- $o(
- <xa>b</xa>=$o(
- <xa>c</xa>=$o()
+ (
+ <ua>b</ua>=(
+ <ua>c</ua>=()
)
)
</p>
@@ -706,22 +736,22 @@
This code produced the following:
</p>
<p class='bcode'>
- $o(
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>name</xa>=<xs>John+Smith</xs>,
- <xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>,
- <xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>,
- <xa>addresses</xa>=$a(
- $o(
- <xa>uri</xa>=<xs>http://sample/addressBook/address/1</xs>,
- <xa>personUri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>street</xa>=<xs>100+Main+Street</xs>,
- <xa>city</xa>=<xs>Anywhereville</xs>,
- <xa>state</xa>=<xs>NY</xs>,
- <xa>zip</xa>=$n(<xs>12345</xs>),
- <xa>isCurrent</xa>=$b(<xs>true</xs>)
+ (
+ <ua>id</ua>=<un>1</un>,
+ <ua>name</ua>=<us>'John+Smith'</us>,
+ <ua>uri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>addressBookUri</ua>=<us>http://sample/addressBook</us>,
+ <ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>,
+ <ua>addresses</ua>=@(
+ (
+ <ua>uri</ua>=<us>http://sample/addressBook/address/1</us>,
+ <ua>personUri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>street</ua>=<us>'100+Main+Street'</us>,
+ <ua>city</ua>=<us>Anywhereville</us>,
+ <ua>state</ua>=<us>NY</us>,
+ <ua>zip</ua>=<un>12345</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
)
)
)
@@ -734,14 +764,14 @@
Person p = UonParser.<jsf>DEFAULT</jsf>.parse(urlencoded, Person.<jk>class</jk>);
<jc>// Render it back as JSON.</jc>
- json = JsonSerializer.<jsf>DEFAULT_SIMPLE_READABLE</jsf>.serialize(p);
+ json = JsonSerializer.<jsf>DEFAULT_LAX_READABLE</jsf>.serialize(p);
</p>
<p>
We print it back out to JSON to show that all the data has been preserved:
</p>
<p class='bcode'>
{
- id: <jk>1</jk>,
+ id: <un>1</un>,
name: <js>'John Smith'</js>,
uri: <js>'http://sample/addressBook/person/1'</js>,
addressBookUri: <js>'http://sample/addressBook'</js>,
@@ -750,11 +780,11 @@
{
uri: <js>'http://sample/addressBook/address/1'</js>,
personUri: <js>'http://sample/addressBook/person/1'</js>,
- id: <jk>1</jk>,
+ id: <un>1</un>,
street: <js>'100 Main Street'</js>,
city: <js>'Anywhereville'</js>,
state: <js>'NY'</js>,
- zip: <jk>12345</jk>,
+ zip: <un>12345</un>,
isCurrent: <jk>true</jk>
}
]
@@ -788,22 +818,22 @@
Starting back with our original URL-encoded string:
</p>
<p class='bcode'>
- $o(
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>name</xa>=<xs>John+Smith</xs>,
- <xa>uri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>addressBookUri</xa>=<xs>http://sample/addressBook</xs>,
- <xa>birthDate</xa>=<xs>1946-08-12T00:00:00Z</xs>,
- <xa>addresses</xa>=$a(
- $o(
- <xa>uri</xa>=<xs>http://sample/addressBook/address/1</xs>,
- <xa>personUri</xa>=<xs>http://sample/addressBook/person/1</xs>,
- <xa>id</xa>=$n(<xs>1</xs>),
- <xa>street</xa>=<xs>100+Main+Street</xs>,
- <xa>city</xa>=<xs>Anywhereville</xs>,
- <xa>state</xa>=<xs>NY</xs>,
- <xa>zip</xa>=$n(<xs>12345</xs>),
- <xa>isCurrent</xa>=$b(<xs>true</xs>)
+ (
+ <ua>id</ua>=<un>1</un>,
+ <ua>name</ua>=<us>'John+Smith'</us>,
+ <ua>uri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>addressBookUri</ua>=<us>http://sample/addressBook</us>,
+ <ua>birthDate</ua>=<us>1946-08-12T00:00:00Z</us>,
+ <ua>addresses</ua>=@(
+ (
+ <ua>uri</ua>=<us>http://sample/addressBook/address/1</us>,
+ <ua>personUri</ua>=<us>http://sample/addressBook/person/1</us>,
+ <ua>id</ua>=<un>1</un>,
+ <ua>street</ua>=<us>'100+Main+Street'</us>,
+ <ua>city</ua>=<us>Anywhereville</us>,
+ <ua>state</ua>=<us>NY</us>,
+ <ua>zip</ua>=<un>12345</un>,
+ <ua>isCurrent</ua>=<uk>true</uk>
)
)
)
@@ -816,7 +846,7 @@
ObjectMap m = UonParser.<jsf>DEFAULT</jsf>.parse(urlencoded, ObjectMap.<jk>class</jk>);
<jc>// Convert it back to JSON.</jc>
- String json = JsonSerializer.<jsf>DEFAULT_SIMPLE_READABLE</jsf>.serialize(m);
+ String json = JsonSerializer.<jsf>DEFAULT_LAX_READABLE</jsf>.serialize(m);
</p>
<p>
What we end up with is the exact same output.<br>
@@ -825,7 +855,7 @@
</p>
<p class='bcode'>
{
- id: <jk>1</jk>,
+ id: <un>1</un>,
name: <js>'John Smith'</js>,
uri: <js>'http://sample/addressBook/person/1'</js>,
addressBookUri: <js>'http://sample/addressBook'</js>,
@@ -834,11 +864,11 @@
{
uri: <js>'http://sample/addressBook/address/1'</js>,
personUri: <js>'http://sample/addressBook/person/1'</js>,
- id: <jk>1</jk>,
+ id: <un>1</un>,
street: <js>'100 Main Street'</js>,
city: <js>'Anywhereville'</js>,
state: <js>'NY'</js>,
- zip: <jk>12345</jk>,
+ zip: <un>12345</un>,
isCurrent: <jk>true</jk>
}
]
@@ -957,7 +987,7 @@
<ja>@RestResource</ja>(
messages=<js>"nls/AddressBookResource"</js>,
properties={
- <ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>),
+ <ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_useWhitespace</jsf>, value=<js>"true"</js>),
<ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_title</jsf>, value=<js>"$L{title}"</js>),
<ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_description</jsf>, value=<js>"$L{description}"</js>),
<ja>@Property</ja>(name=HtmlDocSerializerContext.<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'?method=OPTIONS',doc:'doc'}"</js>)
@@ -968,7 +998,7 @@
</p>
<p>
Notice how serializer and parser properties can be specified using the <code>@RestResource.properties()</code> annotation.<br>
- In this case, we're overriding the <jsf>UON_simpleMode</jsf> property to produce lax UON notation.
+ In this case, we're overriding the <jsf>SERIALIZER_useWhitespace</jsf> property to add whitespace to the output.
The remaining properties are specific to the HTML serializer.
</p>
<p>
@@ -1032,7 +1062,7 @@
serializers={UrlEncodingSerializer.<jk>class</jk>},
parsers={UrlEncodingParser.<jk>class</jk>},
properties={
- <ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>)
+ <ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_useWhitespace</jsf>, value=<js>"true"</js>)
}
)
<jk>public class</jk> AddressBookResource <jk>extends</jk> RestServlet {
@@ -1046,7 +1076,7 @@
serializers={UrlEncodingSerializer.<jk>class</jk>},
parsers={UrlEncodingParser.<jk>class</jk>},
properties={
- <ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>)
+ <ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_useWhitespace</jsf>, value=<js>"true"</js>)
}
)
<jk>public</jk> Person getPerson(RestRequest req, <ja>@Path</ja> <jk>int</jk> id) throws Exception {
@@ -1130,7 +1160,7 @@
In Wink, this is accomplished by adding an entry to a config file.
</p>
<p class='bcode'>
- <xt><web-app</xt> <xa>version</xa>=<xs>"2.3"</xs><xt>></xt>
+ <xt><web-app</xt> <ua>version</ua>=<us>"2.3"</us><xt>></xt>
<xt><servlet></xt>
<xt><servlet-name></xt>WinkService<xt></servlet-name></xt>
<xt><servlet-class></xt>org.apache.wink.server.internal.servlet.RestServlet<xt></servlet-class></xt>
@@ -1154,7 +1184,7 @@
<ja>@Produces</ja>(<js>"*/*"</js>)
<ja>@RestMethod</ja>( <jc>/* Override some properties */</jc>
properties={
- <ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>)
+ <ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_useWhitespace</jsf>, value=<js>"true"</js>)
}
)
<jk>public</jk> Message getMessage() {
@@ -1203,7 +1233,7 @@
UrlEncodingParser.<jk>class</jk>,
}
properties={
- <ja>@Property</ja>(name=UonSerializerContext.<jsf>UON_simpleMode</jsf>, value=<js>"true"</js>)
+ <ja>@Property</ja>(name=SerializerContext.<jsf>SERIALIZER_useWhitespace</jsf>, value=<js>"true"</js>)
}
)
<jk>public final class</jk> MyUrlEncodingProvider <jk>extends</jk> BaseProvider {}
@@ -1226,7 +1256,7 @@
</p>
<p class='bcode'>
<jc>// Create a client to handle URL-encoded requests and responses.</jc>
- RestClient client = <jk>new</jk> RestClient(UrlEncodingSerializer.<jk>class</jk>, UrlEncodingParser.<jk>class</jk>);
+ RestClient client = <uk>new</uk> RestClient(UrlEncodingSerializer.<uk>class</uk>, UrlEncodingParser.<uk>class</uk>);
</p>
<p>
The client handles all content negotiation based on the registered serializers and parsers.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
index f352c47..a13c1d9 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlParser.java
@@ -77,7 +77,6 @@ public class XmlParser extends ReaderParser {
PojoSwap<T,Object> transform = (PojoSwap<T,Object>)eType.getPojoSwap();
ClassMeta<?> sType = eType.getSerializedClassMeta();
session.setCurrentClass(sType);
- BeanRegistry breg = (pMeta == null ? session.getBeanRegistry() : pMeta.getBeanRegistry());
String wrapperAttr = (isRoot && session.isPreserveRootElement()) ? r.getName().getLocalPart() : null;
String typeAttr = r.getAttributeValue(null, session.getBeanTypePropertyName());
@@ -92,11 +91,11 @@ public class XmlParser extends ReaderParser {
}
}
- if (breg.hasName(typeAttr)) {
- sType = eType = (ClassMeta<T>)breg.getClassMeta(typeAttr);
- } else if (elementName != null && breg.hasName(elementName) && ! elementName.equals(currAttr)) {
- sType = eType = (ClassMeta<T>)breg.getClassMeta(elementName);
- }
+ ClassMeta tcm = session.getClassMeta(typeAttr, pMeta, eType);
+ if (tcm == null && elementName != null && ! elementName.equals(currAttr))
+ tcm = session.getClassMeta(elementName, pMeta, eType);
+ if (tcm != null)
+ sType = eType = tcm;
Object o = null;
@@ -111,7 +110,7 @@ public class XmlParser extends ReaderParser {
parseIntoMap(session, r, m, string(), object(), pMeta);
if (wrapperAttr != null)
m = new ObjectMap(session).append(wrapperAttr, m);
- o = breg.cast(m);
+ o = session.cast(m, pMeta, eType);
} else if (jsonType == ARRAY)
o = parseIntoCollection(session, r, new ObjectList(session), object(), pMeta);
else if (jsonType == STRING) {
@@ -280,8 +279,6 @@ public class XmlParser extends ReaderParser {
if (bpm == null) {
if (xmlMeta.getAttrsProperty() != null) {
xmlMeta.getAttrsProperty().add(m, key, val);
- } else if (m.getMeta().isSubTyped()) {
- m.put(key, val);
} else {
Location l = r.getLocation();
onUnknownProperty(session, key, m, l.getLineNumber(), l.getColumnNumber());
@@ -362,14 +359,9 @@ public class XmlParser extends ReaderParser {
currAttr = session.getElementName(r);
BeanPropertyMeta pMeta = xmlMeta.getPropertyMeta(currAttr);
if (pMeta == null) {
- if (m.getMeta().isSubTyped()) {
- Object value = parseAnything(session, string(), currAttr, r, m.getBean(false), false, null);
- m.put(currAttr, value);
- } else {
- Location loc = r.getLocation();
- onUnknownProperty(session, currAttr, m, loc.getLineNumber(), loc.getColumnNumber());
- skipCurrentTag(r);
- }
+ Location loc = r.getLocation();
+ onUnknownProperty(session, currAttr, m, loc.getLineNumber(), loc.getColumnNumber());
+ skipCurrentTag(r);
} else {
session.setCurrentProperty(pMeta);
XmlFormat xf = pMeta.getExtendedMeta(XmlBeanPropertyMeta.class).getXmlFormat();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
index 01d8138..397c513 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSchemaSerializer.java
@@ -261,7 +261,7 @@ public class XmlSchemaSerializer extends XmlSerializer {
this.defaultNs = defaultNs;
this.targetNs = targetNs;
this.session = session;
- w = new XmlWriter(sw, session.isUseIndentation(), session.isTrimStrings(), session.getQuoteChar(), null, null, true, null);
+ w = new XmlWriter(sw, session.isUseWhitespace(), session.isTrimStrings(), session.getQuoteChar(), null, null, true, null);
int i = session.getIndent();
w.oTag(i, "schema");
w.attr("xmlns", xs.getUri());
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index 7c38f84..0f22162 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -154,7 +154,7 @@ public class XmlSerializer extends WriterSerializer {
public static class SqReadable extends Sq {
/** Constructor */
public SqReadable() {
- setUseIndentation(true);
+ setUseWhitespace(true);
}
}
@@ -179,7 +179,7 @@ public class XmlSerializer extends WriterSerializer {
public static class NsSqReadable extends NsSq {
/** Constructor */
public NsSqReadable() {
- setUseIndentation(true);
+ setUseWhitespace(true);
}
}
@@ -973,8 +973,8 @@ public class XmlSerializer extends WriterSerializer {
}
@Override /* Serializer */
- public XmlSerializer setUseIndentation(boolean value) throws LockedException {
- super.setUseIndentation(value);
+ public XmlSerializer setUseWhitespace(boolean value) throws LockedException {
+ super.setUseWhitespace(value);
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index 5b1ae85..5ab38d3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -170,6 +170,6 @@ public class XmlSerializerSession extends SerializerSession {
Object output = getOutput();
if (output instanceof XmlWriter)
return (XmlWriter)output;
- return new XmlWriter(super.getWriter(), isUseIndentation(), isTrimStrings(), getQuoteChar(), getRelativeUriBase(), getAbsolutePathUriBase(), isEnableNamespaces(), getDefaultNamespace());
+ return new XmlWriter(super.getWriter(), isUseWhitespace(), isTrimStrings(), getQuoteChar(), getRelativeUriBase(), getAbsolutePathUriBase(), isEnableNamespaces(), getDefaultNamespace());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/java/org/apache/juneau/xml/XmlWriter.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlWriter.java b/juneau-core/src/main/java/org/apache/juneau/xml/XmlWriter.java
index 1140561..6f5ac83 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlWriter.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlWriter.java
@@ -34,7 +34,7 @@ public class XmlWriter extends SerializerWriter {
* Constructor.
*
* @param out The wrapped writer.
- * @param useIndentation If <jk>true</jk> XML elements will be indented.
+ * @param useWhitespace If <jk>true</jk> XML elements will be indented.
* @param trimStrings If <jk>true</jk>, strings should be trimmed before they're serialized.
* @param quoteChar The quote character to use for attributes. Should be <js>'\''</js> or <js>'"'</js>.
* @param relativeUriBase The base (e.g. <js>https://localhost:9443/contextPath"</js>) for relative URIs (e.g. <js>"my/path"</js>).
@@ -42,8 +42,8 @@ public class XmlWriter extends SerializerWriter {
* @param enableNs Flag to indicate if XML namespaces are enabled.
* @param defaultNamespace The default namespace if XML namespaces are enabled.
*/
- public XmlWriter(Writer out, boolean useIndentation, boolean trimStrings, char quoteChar, String relativeUriBase, String absolutePathUriBase, boolean enableNs, Namespace defaultNamespace) {
- super(out, useIndentation, true, trimStrings, quoteChar, relativeUriBase, absolutePathUriBase);
+ public XmlWriter(Writer out, boolean useWhitespace, boolean trimStrings, char quoteChar, String relativeUriBase, String absolutePathUriBase, boolean enableNs, Namespace defaultNamespace) {
+ super(out, useWhitespace, trimStrings, quoteChar, relativeUriBase, absolutePathUriBase);
this.enableNs = enableNs;
this.defaultNsPrefix = defaultNamespace == null ? null : defaultNamespace.name;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/javadoc/doc-files/Server.Uon.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Server.Uon.png b/juneau-core/src/main/javadoc/doc-files/Server.Uon.png
deleted file mode 100644
index 28e4baf..0000000
Binary files a/juneau-core/src/main/javadoc/doc-files/Server.Uon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/javadoc/doc-files/Server.UrlEncoding.png
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/doc-files/Server.UrlEncoding.png b/juneau-core/src/main/javadoc/doc-files/Server.UrlEncoding.png
deleted file mode 100644
index 1572968..0000000
Binary files a/juneau-core/src/main/javadoc/doc-files/Server.UrlEncoding.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/overview.html b/juneau-core/src/main/javadoc/overview.html
index 8a5032b..50701c5 100644
--- a/juneau-core/src/main/javadoc/overview.html
+++ b/juneau-core/src/main/javadoc/overview.html
@@ -318,6 +318,14 @@
// <tr><td>age</td><td>21</td></tr>
// </table></jc>
String html = HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // "(name='John Smith',age=21)"</jc>
+ String uon = UonSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // "name='John+Smith'&age=21"</jc>
+ String urlencoding = UrlEncodingSerializer.<jsf>DEFAULT</jsf>.serialize(p);
<jc>// Produces:
// 82 A4 6E 61 6D 65 AA 4A 6F 68 6E 20 53 6D 69 74 68 A3 61 67 65 15 </jc>
@@ -817,7 +825,7 @@
<jk>this</jk>.<jf>value2</jf> = value2;
}
- <jc>// Special swap method that converts this template to a serializable bean,
+ <jc>// Special swap method that converts this template to a serializable bean</jc>
<jk>public</jk> Form swap(BeanSession session) {
<jk>return</jk> <jsm>form</jsm>(<jf>action</jf>,
<jsm>input</jsm>(<js>"text"</js>).name(<js>"v1"</js>).value(<jf>value1</jf>),
@@ -1054,9 +1062,6 @@
<ul>
<li>You specify the list of possible subclasses through an annotation on a parent bean class.
<li>You do not need to register the subtype classes on the bean dictionary of the parser.
- <li>The default helper attribute name is <js>"_subtype"</js>, not <js>"_type"</js>.
- <li>Bean subtype virtual properties are ALWAYS serialized.
- They are not controlled by the {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties} setting.
</ul>
<p>
In the following example, the abstract class has two subclasses:
@@ -1064,7 +1069,7 @@
<p class='bcode'>
<jc>// Abstract superclass</jc>
<ja>@Bean</ja>(
- subTypes={A1.<jk>class</jk>, A2.<jk>class</jk>}
+ beanDictionary={A1.<jk>class</jk>, A2.<jk>class</jk>}
)
<jk>public abstract class</jk> A {
<jk>public</jk> String <jf>f0</jf> = <js>"f0"</js>;
@@ -1083,14 +1088,14 @@
}
</p>
<p>
- When serialized, the subtype is serialized as a virtual <js>"_subtype"</js> property:
+ When serialized, the subtype is serialized as a virtual <js>"_type"</js> property:
</p>
<p class='bcode'>
JsonSerializer s = JsonSerializer.<jsf>DEFAULT_LAX</jsf>;
A1 a1 = <jk>new</jk> A1();
a1.<jf>f1</jf> = <js>"f1"</js>;
String r = s.serialize(a1);
- <jsm>assertEquals</jsm>(<js>"{_subtype:'A1',f1:'f1',f0:'f0'}"</js>, r);
+ <jsm>assertEquals</jsm>(<js>"{_type:'A1',f1:'f1',f0:'f0'}"</js>, r);
</p>
<p>
The following shows what happens when parsing back into the original object.
@@ -1100,9 +1105,6 @@
A a = p.parse(r, A.<jk>class</jk>);
<jsm>assertTrue</jsm>(a <jk>instanceof</jk> A1);
</p>
- <p class='info'>
- The <js>"_subtype"</js> property name can be overridden using the {@link org.apache.juneau.annotation.Bean#subTypeProperty() @Bean.subTypeProperty()} annotation.
- </p>
</div>
</div>
@@ -5624,6 +5626,29 @@
methods for retrieving Map and Collection class metas.
Replaces the various <code>getMapClassMeta()</code>/<code>getCollectionClassMeta()</code> methods.
<li>New section added to this document: <a class='doclink' href='#DTOs'>Juneau Data Transfer Objects (org.apache.juneau.dto)</a>
+ <li>Modified the UON specification to work with mixed content.
+ <ul>
+ <li>The new specification is considerably cleaner and eliminates the need for separate normal/simple modes.
+ <br>It also allows for arbitrary whitespace to be added to the output without any confusion.
+ <li>Eliminated the <code>UonParser.<jsf>DEFAULT_WS_AWARE</jsf></code> and <code>UrlEncodingParser.<jsf>DEFAULT_WS_AWARE</jsf></code> parsers.
+ <br>The normal {@link org.apache.juneau.urlencoding.UonParser#DEFAULT} and {@link org.apache.juneau.urlencoding.UrlEncodingParser#DEFAULT} parsers will now handle whitespace.
+ <li>Eliminated the <code>UonParserContext.<jsf>UON_whitespaceAware</jsf></code> configuration setting.
+ <li>Eliminated the <code>UonSerializer.<jsf>DEFAULT_SIMPLE</jsf></code>, <code>UonSerializer.<jsf>DEFAULT_SIMPLE_ENCODING</jsf></code>
+ and <code>UrlEncodingSerializer.<jsf>DEFAULT_SIMPLE</jsf></code>
+ serializers since there is no separate simple mode anymore.
+ <li>Eliminated the <code>UonParserContext.<jsf>UON_simpleMode</jsf></code> configuration setting.
+ </ul>
+ <li>Added new {@link org.apache.juneau.serializer.OutputStreamSerializer#serializeToHex(Object)} method.
+ <br>Useful mostly for testing purposes.
+ <br>Equivalently, the {@link org.apache.juneau.parser.InputStreamParser#parse(Object,Class)} method can now
+ read the output from this method.
+ <li>Eliminated the <code><ja>@Bean</ja>(subTypeProperty)</code> and <code><ja>@Bean</ja>(subTypes)</code> annotations
+ and replaced them with the ability to define subtypes using the existing {@link org.apache.juneau.annotation.Bean#beanDictionary() @Bean.beanDictionary()}
+ annotation on parent classes and interfaces.
+ <br>This has the added benefit of simplifying the overall code.
+ <li>The {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addBeanTypeProperties} setting is now enabled by default.
+ <li>Combined the <code>SERIALIZER_addIndentation</code>/<code>JSON_addWhitespace</code>/<code>UON_addWhitespace</code>
+ properties into a single {@link org.apache.juneau.serializer.SerializerContext#SERIALIZER_addWhitespace} setting.
</ul>
<h6 class='topic'>org.apache.juneau.rest</h6>
@@ -5652,6 +5677,7 @@
<li>{@link org.apache.juneau.rest.RestRequest#getBody(Class)}
<li>{@link org.apache.juneau.rest.RestRequest#getBody(Type,Type...)}
</ul>
+ <li>Fixed issue where whitespace was not added to UON/URL-Encoding output when <code>&plainText=true</code> specified.
</ul>
</div>
@@ -6077,7 +6103,7 @@
<li>{@link org.apache.juneau.parser.Parser} methods now check for <jk>null</jk> input.
<li>{@link org.apache.juneau.serializer.SerializerGroup} and {@link org.apache.juneau.parser.ParserGroup} ignores serializers and parsers if they throw <code>NoClassDefFoundErrors</code>.
<li>{@link org.apache.juneau.urlencoding.UrlEncodingParser} creates lists if the same attribute name is encountered more than once. Before it would just replace the previous value with the new value.
- <li>New {@link org.apache.juneau.urlencoding.UrlEncodingSerializer#DEFAULT_SIMPLE_EXPANDED} serializer.
+ <li>New <code><del>UrlEncodingSerializer.DEFAULT_SIMPLE_EXPANDED</del></code> serializer.
<li>Changes to {@link org.apache.juneau.utils.Args}:
<ul>
<li><code>getMainArg(int)</code> changed to {@link org.apache.juneau.utils.Args#getArg(int)}.
@@ -6840,7 +6866,7 @@
<li>Several improvements to URL-Encoding support.
<ul>
<li>Improved whitespace handling in {@link org.apache.juneau.urlencoding.UonParser}.
- <li>New {@link org.apache.juneau.urlencoding.UonParserContext#UON_whitespaceAware} property for controlling whether whitespace is ignored.
+ <li>New <code><del>UonParserContext.UON_whitespaceAware</del></code> property for controlling whether whitespace is ignored.
<li>New {@link org.apache.juneau.urlencoding.UrlEncodingContext#URLENC_expandedParams} property for controlling whether arrays/Collections
should be serialized/parsed as multi-part parameters.
<li>New {@link org.apache.juneau.urlencoding.annotation.UrlEncoding#expandedParams() @UrlEncoding.expandedParams()}
@@ -7171,7 +7197,7 @@
<li>Changed the default ordering of bean properties to be in parent-to-child class order.
<li>New {@link org.apache.juneau.transform.BeanFilter#readProperty(Object,String,Object) readProperty()} and {@link org.apache.juneau.transform.BeanFilter#writeProperty(Object,String,Object) writeProperty()}
methods added to {@link org.apache.juneau.transform.BeanFilter} class to allow individualized serialization and parsing behavior on a class-by-class basis.
- <li>Eliminated previous restriction where bean subtype attributes had to be listed first in JSON objects when using the {@link org.apache.juneau.annotation.Bean#subTypeProperty()} annotation.
+ <li>Eliminated previous restriction where bean subtype attributes had to be listed first in JSON objects when using the <code><del>Bean.subTypeProperty()</del></code> annotation.
The previous behavior was not strictly JSON-compliant since JSON objects are supposed to consist of unordered lists of key/value pairs.
While targeted for JSON, the restriction is also lifted for all other parsers.
<li>New fluent-style {@link org.apache.juneau.BeanMap#load(String) BeanMap.load()} methods for initializing bean maps.
@@ -7552,7 +7578,7 @@
</p>
<ul class='spaced-list'>
<li>
- Fixed bug involving beans using {@link org.apache.juneau.annotation.Bean#subTypes()} annotation in addition to <code>subTypes</code> property.
+ Fixed bug involving beans using <code><del>Bean.subTypes()</del></code> annotation in addition to <code>subTypes</code> property.
</li>
<li>
Modified the JSON parser to handle non-existent JSON values to get around an issue where Cognos was generating invalid JSON.
@@ -7572,7 +7598,7 @@
Revamped the API for filter support:
<ul>
<li>Updated {@link org.apache.juneau.transform.BeanFilter} class to mirror the {@link org.apache.juneau.annotation.Bean @Bean} annotation.</li>
- <li>Introduced support for bean {@link org.apache.juneau.annotation.Bean#subTypeProperty() subtypes}. </li>
+ <li>Introduced support for bean <code><del>Bean.subTypeProperty() subtypes</del></code>. </li>
<li>Replaced <code><ja>@Bean</ja>(filter=xxx)</code> with new <del><code>@Transform</code></del> annotation.</li>
</ul>
</li>
@@ -8709,3 +8735,5 @@
</div>
</body>
+
+
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-core/src/main/javadoc/resources/juneau-code.css
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/javadoc/resources/juneau-code.css b/juneau-core/src/main/javadoc/resources/juneau-code.css
index f48f7cd..b0be23a 100644
--- a/juneau-core/src/main/javadoc/resources/juneau-code.css
+++ b/juneau-core/src/main/javadoc/resources/juneau-code.css
@@ -101,8 +101,8 @@ jd { color: #3f5fbf; }
jt { color: #7f9fbf; font-weight: bold; }
jk { color: #7f0055; font-weight: bold; }
js { color: blue; }
-jf { color: blue; }
-jsf { color: blue; font-style: italic; }
+jf { color: DarkBlue; }
+jsf { color: DarkBlue; font-style: italic; }
jsm { font-style: italic; }
ja { color: grey; }
@@ -113,6 +113,12 @@ xc { color: mediumblue; }
xs { color: blue; font-style: italic; }
xv { color: black; }
+/*--- URLEncoding/UON code effects ---*/
+ua { color: black; } /* Attribute name */
+uk { color: #7f0055; font-weight: bold; } /* true/false/null */
+un { color: DarkBlue; } /* Number value */
+us { color: blue; } /* String value */
+
/*--- Manifest-file code effects ---*/
mk { color: DarkRed; font-weight: bold; }
mv { color: DarkBlue;}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
index 67ae42a..dbb736a 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java
@@ -29,7 +29,7 @@ import org.apache.juneau.xml.*;
import org.junit.*;
@SuppressWarnings({"serial"})
-public class AddressBookResourceTest {
+public class AddressBookResourceTest extends RestTestcase {
private static boolean debug = false;
@@ -166,35 +166,35 @@ public class AddressBookResourceTest {
assertEquals(1, people.size());
assertEquals("Barack Obama", people.get(0).name);
- r = client.doGet("/addressBook/people?q=(name='Barack+Obama')");
+ r = client.doGet("/addressBook/people?q=(name='~'Barack+Obama~'')");
people = r.getResponse(PersonList.class);
assertEquals(1, people.size());
assertEquals("Barack Obama", people.get(0).name);
- r = client.doGet("/addressBook/people?q=(name='Barack%20Obama')");
+ r = client.doGet("/addressBook/people?q=(name='~'Barack%20Obama~'')");
people = r.getResponse(PersonList.class);
assertEquals(1, people.size());
assertEquals("Barack Obama", people.get(0).name);
- r = client.doGet("/addressBook/people?v=(name,birthDate)");
+ r = client.doGet("/addressBook/people?v=@(name,birthDate)");
people = r.getResponse(PersonList.class);
assertEquals("Barack Obama", people.get(0).name);
assertTrue(people.get(0).getAge() > 10);
assertEquals(0, people.get(0).addresses.size());
- r = client.doGet("/addressBook/people?v=(addresses,birthDate)");
+ r = client.doGet("/addressBook/people?v=@(addresses,birthDate)");
people = r.getResponse(PersonList.class);
assertNull(people.get(0).name);
assertTrue(people.get(0).getAge() > 10);
assertEquals(2, people.get(0).addresses.size());
- r = client.doGet("/addressBook/people?s=($o(age=d))");
+ r = client.doGet("/addressBook/people?s=@((age=d))");
people = r.getResponse(PersonList.class);
assertTrue(people.get(0).getAge() > 10);
- r = client.doGet("/addressBook/people?s=(age)");
+ r = client.doGet("/addressBook/people?s=@(age)");
people = r.getResponse(PersonList.class);
assertTrue(people.get(0).getAge() > 10);
- r = client.doGet("/addressBook/people?s=($o(age=a))");
+ r = client.doGet("/addressBook/people?s=@((age=a))");
people = r.getResponse(PersonList.class);
assertTrue(people.get(0).getAge() > 10);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RestTestcase.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RestTestcase.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RestTestcase.java
new file mode 100644
index 0000000..0b79f66
--- /dev/null
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RestTestcase.java
@@ -0,0 +1,37 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.examples.rest;
+
+import org.apache.juneau.examples.rest.TestMicroservice;
+import org.junit.*;
+
+/**
+ * Superclass of REST testcases that start up the REST test microservice before running the tests locally.
+ *
+ * @author James Bognar (james.bognar@salesforce.com)
+ */
+public class RestTestcase {
+
+ private static boolean microserviceStarted;
+
+ @BeforeClass
+ public static void setUp() {
+ microserviceStarted = TestMicroservice.startMicroservice();
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ if (microserviceStarted)
+ TestMicroservice.stopMicroservice();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
index a0eba19..b3c7c98 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java
@@ -25,7 +25,7 @@ import org.apache.juneau.rest.labels.*;
import org.apache.juneau.xml.*;
import org.junit.*;
-public class RootResourcesTest {
+public class RootResourcesTest extends RestTestcase {
private static String path = URI.create(Constants.getSampleUrl()).getPath(); // /jazz/juneau/sample
private static boolean debug = false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
index 945e14a..28f38fe 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java
@@ -23,7 +23,7 @@ import org.apache.juneau.urlencoding.*;
import org.apache.juneau.xml.*;
import org.junit.*;
-public class SampleRemoteableServicesResourceTest {
+public class SampleRemoteableServicesResourceTest extends RestTestcase {
static RestClient[] clients;
@@ -62,7 +62,7 @@ public class SampleRemoteableServicesResourceTest {
new CreateAddress("Test street", "Test city", "Test state", 12345, true))
);
assertEquals(
- "{id:x,name:'Test Person',birthDate:'Aug 1, 1999',addresses:[{id:x,street:'Test street',city:'Test city',state:'Test state',zip:12345,isCurrent:true}],age:x}",
+ "{_type:'person',id:x,name:'Test Person',birthDate:'Aug 1, 1999',addresses:[{id:x,street:'Test street',city:'Test city',state:'Test state',zip:12345,isCurrent:true}],age:x}",
JsonSerializer.DEFAULT_LAX.toString(p).replaceAll("id:\\d+", "id:x").replaceAll("age:\\d+", "age:x"));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMicroservice.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMicroservice.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMicroservice.java
new file mode 100644
index 0000000..303b1ca
--- /dev/null
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMicroservice.java
@@ -0,0 +1,57 @@
+// ***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+// * with the License. You may obtain a copy of the License at *
+// * *
+// * http://www.apache.org/licenses/LICENSE-2.0 *
+// * *
+// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+// * specific language governing permissions and limitations under the License. *
+// ***************************************************************************************************************************
+package org.apache.juneau.examples.rest;
+
+import java.util.*;
+
+import org.apache.juneau.microservice.*;
+
+/**
+ * Utility class for starting up the examples microservice.
+ * @author james.bognar
+ */
+public class TestMicroservice {
+ static Microservice microservice;
+
+ /**
+ * Starts the microservice.
+ * @return <jk>true</jk> if the service started, <jk>false</jk> if it's already started.
+ * If this returns <jk>false</jk> then don't call stopMicroservice()!.
+ */
+ public static boolean startMicroservice() {
+ if (microservice != null)
+ return false;
+ try {
+ Locale.setDefault(Locale.US);
+ microservice = new RestMicroservice().setConfig("examples.cfg", false);
+ microservice.start();
+ return true;
+ } catch (Throwable e) {
+ // Probably already started.
+ System.err.println(e); // NOT DEBUG
+ return false;
+ }
+ }
+
+ /**
+ * Stops the microservice.
+ */
+ public static void stopMicroservice() {
+ try {
+ microservice.stop();
+ microservice = null;
+ } catch (Exception e) {
+ System.err.println(e); // NOT DEBUG
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
index 66596ce..f41b122 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestMultiPartFormPostsTest.java
@@ -23,7 +23,7 @@ import org.apache.juneau.rest.client.*;
import org.apache.juneau.utils.*;
import org.junit.*;
-public class TestMultiPartFormPostsTest {
+public class TestMultiPartFormPostsTest extends RestTestcase {
private static String URL = "/tempDir";
boolean debug = false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
index 39463dd..3cd0ed3 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/TestUtils.java
@@ -221,7 +221,7 @@ public class TestUtils {
* Test whitespace and generated schema.
*/
public static void validateXml(Object o, XmlSerializer s) throws Exception {
- s = s.clone().setUseIndentation(true).setEnableNamespaces(true).setAddNamespaceUrisToRoot(true);
+ s = s.clone().setUseWhitespace(true).setEnableNamespaces(true).setAddNamespaceUrisToRoot(true);
String xml = s.serialize(o);
String xmlSchema = null;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/_TestSuite.java
----------------------------------------------------------------------
diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/_TestSuite.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/_TestSuite.java
index 214fc8b..4bbc700 100644
--- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/_TestSuite.java
+++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/_TestSuite.java
@@ -12,9 +12,6 @@
// ***************************************************************************************************************************
package org.apache.juneau.examples.rest;
-import java.util.*;
-
-import org.apache.juneau.microservice.*;
import org.junit.*;
import org.junit.runner.*;
import org.junit.runners.*;
@@ -33,25 +30,14 @@ import org.junit.runners.Suite.*;
TestMultiPartFormPostsTest.class
})
public class _TestSuite {
- static Microservice microservice;
@BeforeClass
public static void setUp() {
- try {
- Locale.setDefault(Locale.US);
- microservice = new RestMicroservice().setConfig("examples.cfg", false);
- microservice.start();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ TestMicroservice.startMicroservice();
}
@AfterClass
public static void tearDown() {
- try {
- microservice.stop();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ TestMicroservice.stopMicroservice();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
index e65c00a..e3d0f48 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ParamsResource.java
@@ -26,7 +26,6 @@ import org.apache.juneau.plaintext.*;
import org.apache.juneau.rest.*;
import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.transforms.*;
-import org.apache.juneau.urlencoding.*;
/**
* JUnit automated testcase resource.
@@ -269,8 +268,7 @@ public class ParamsResource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="POST", path="/testFormPostsWithMultiParamsUsingProperty",
properties={
- @Property(name=URLENC_expandedParams, value="true"),
- @Property(name=UonSerializerContext.UON_simpleMode, value="true")
+ @Property(name=URLENC_expandedParams, value="true")
}
)
public DTO2s.B testFormPostsWithMultiParamsViaProperty(@Body DTO2s.B content) throws Exception {
@@ -282,11 +280,7 @@ public class ParamsResource extends RestServletDefault {
// using @UrlEncoding(expandedParams=true) annotation.
// A simple round-trip test to verify that both serializing and parsing works.
//====================================================================================================
- @RestMethod(name="POST", path="/testFormPostsWithMultiParamsUsingAnnotation",
- properties={
- @Property(name=UonSerializerContext.UON_simpleMode, value="true")
- }
- )
+ @RestMethod(name="POST", path="/testFormPostsWithMultiParamsUsingAnnotation")
public DTO2s.C testFormPostsWithMultiParamsUsingAnnotation(@Body DTO2s.C content) throws Exception {
return content;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/AcceptCharsetTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/AcceptCharsetTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/AcceptCharsetTest.java
index 9cce642..0bace15 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/AcceptCharsetTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/AcceptCharsetTest.java
@@ -22,7 +22,7 @@ import org.apache.juneau.internal.*;
import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class AcceptCharsetTest {
+public class AcceptCharsetTest extends RestTestcase {
boolean debug = false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/BeanContextPropertiesTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/BeanContextPropertiesTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/BeanContextPropertiesTest.java
index cab1f3d..6580d9d 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/BeanContextPropertiesTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/BeanContextPropertiesTest.java
@@ -18,7 +18,7 @@ import org.apache.juneau.json.*;
import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class BeanContextPropertiesTest {
+public class BeanContextPropertiesTest extends RestTestcase {
boolean debug = false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CallbackStringsTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CallbackStringsTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CallbackStringsTest.java
index 0b73c13..b65d2f8 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CallbackStringsTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CallbackStringsTest.java
@@ -17,7 +17,7 @@ import static org.junit.Assert.*;
import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class CallbackStringsTest {
+public class CallbackStringsTest extends RestTestcase {
//====================================================================================================
// Basic tests using @Body parameter
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CharsetEncodingsTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CharsetEncodingsTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CharsetEncodingsTest.java
index 25197f8..2aeb4f7 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CharsetEncodingsTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/CharsetEncodingsTest.java
@@ -23,7 +23,7 @@ import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class CharsetEncodingsTest {
+public class CharsetEncodingsTest extends RestTestcase {
private static boolean debug = false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ClientVersionTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ClientVersionTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ClientVersionTest.java
index c7ca711..85c168b 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ClientVersionTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ClientVersionTest.java
@@ -18,7 +18,7 @@ import org.apache.juneau.plaintext.*;
import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class ClientVersionTest {
+public class ClientVersionTest extends RestTestcase {
private static String URL = "/testClientVersion";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
index be7ebaa..3856466 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ConfigTest.java
@@ -21,7 +21,7 @@ import org.apache.juneau.rest.*;
import org.apache.juneau.rest.client.*;
import org.junit.*;
-public class ConfigTest {
+public class ConfigTest extends RestTestcase {
private static String URL = "/testConfig";
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/097b8103/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/Constants.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/Constants.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/Constants.java
index 0f8a09d..a996b3b 100644
--- a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/Constants.java
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/Constants.java
@@ -15,7 +15,7 @@ package org.apache.juneau.rest.test;
import java.net.*;
-public class Constants {
+public class Constants extends RestTestcase {
private static String juneauSampleUrl = System.getProperty("JUNO_SAMPLE_URL", "http://localhost:10000");
private static URI juneauSampleUri = (juneauSampleUrl == null ? null : URI.create(juneauSampleUrl));