You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-98Lines changed: 3 additions & 98 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,6 @@ This guide introduces the HTTP-RPC framework and provides an overview of its key
19
19
* [API Documentation](#api-documentation)
20
20
*[JSONEncoder and JSONDecoder](#jsonencoder-and-jsondecoder)
21
21
*[CSVEncoder and CSVDecoder](#csvencoder-and-csvdecoder)
22
-
*[XMLEncoder](#xmlencoder)
23
22
*[TemplateEncoder](#templateencoder)
24
23
*[BeanAdapter](#beanadapter)
25
24
*[ResultSetAdapter and Parameters](#resultsetadapter-and-parameters)
@@ -33,7 +32,7 @@ The complete HTTP-RPC framework can be downloaded as a single JAR file [here](ht
33
32
Alternatively, dependencies can be specified individually:
34
33
35
34
*[org.httprpc:httprpc-client](http://repo1.maven.org/maven2/org/httprpc/httprpc-client/) - provides support for consuming web services and working with JSON/CSV and relational databases
36
-
*[org.httprpc:httprpc-server](http://repo1.maven.org/maven2/org/httprpc/httprpc-server/) - depends on client; provides support for implementing web services and working with XML and template documents
35
+
*[org.httprpc:httprpc-server](http://repo1.maven.org/maven2/org/httprpc/httprpc-server/) - depends on client; provides support for implementing web services and working with template documents
37
36
38
37
HTTP-RPC requires Java 8 or later and a servlet container supporting Java Servlet specification 3.1 or later.
39
38
@@ -54,7 +53,6 @@ The HTTP-RPC framework includes the following classes:
54
53
*`JSONDecoder` - decodes an object hierarchy from JSON
55
54
*`JSONEncoder` - an object hierarchy to JSON
56
55
*`TemplateEncoder` - encodes an object hierarchy using a template document
57
-
*`XMLEncoder` - encodes an object hierarchy to XML
58
56
*`org.httprpc.beans`
59
57
*`BeanAdapter` - presents the properties of a Java bean object as a map and vice versa
60
58
*`Ignore` - indicates that a bean property should be ignored
@@ -452,99 +450,6 @@ JSONEncoder jsonEncoder = new JSONEncoder();
452
450
jsonEncoder.write(months, System.out);
453
451
```
454
452
455
-
## XMLEncoder
456
-
The `XMLEncoder` class can be used to serialize an object hierarchy as XML (for example, to prepare it for further transformation via [XSLT](https://www.w3.org/TR/xslt/all/)).
457
-
458
-
The root object provided to the encoder is an iterable sequence of map values. For example:
459
-
460
-
```java
461
-
List<Map<String, ?>> values =...;
462
-
463
-
XMLEncoder xmlEncoder =newXMLEncoder();
464
-
465
-
xmlEncoder.write(values, writer);
466
-
```
467
-
468
-
Sequences are serialized as shown below. Each `<item>` element corresponds to a map value produced by the sequence's iterator:
469
-
470
-
```xml
471
-
<?xml version="1.0" encoding="UTF-8"?>
472
-
473
-
<root>
474
-
<item/>
475
-
<item/>
476
-
<item/>
477
-
...
478
-
</root>
479
-
```
480
-
481
-
Map values are generally encoded as XML attributes. For example, given this map:
482
-
483
-
```json
484
-
{
485
-
"a": 1,
486
-
"b": 2,
487
-
"c": 3
488
-
}
489
-
```
490
-
491
-
the resulting XML would be as follows:
492
-
493
-
```xml
494
-
<itema="1"b="2"c="3"/>
495
-
```
496
-
497
-
Nested maps are encoded as sub-elements. For example, given this map:
498
-
499
-
```json
500
-
{
501
-
"d": {
502
-
"e": 4,
503
-
"f": 5
504
-
}
505
-
}
506
-
```
507
-
508
-
the XML output would be as follows:
509
-
510
-
```xml
511
-
<item>
512
-
<de="4"f="5"/>
513
-
</item>
514
-
```
515
-
516
-
Nested sequences are also supported. For example, this JSON:
517
-
518
-
```json
519
-
{
520
-
"g": [
521
-
{
522
-
"h": 6
523
-
},
524
-
{
525
-
"h": 7
526
-
},
527
-
{
528
-
"h": 8
529
-
}
530
-
]
531
-
}
532
-
```
533
-
534
-
would produce the following output:
535
-
536
-
```xml
537
-
<item>
538
-
<g>
539
-
<itemh="6"/>
540
-
<itemh="7"/>
541
-
<itemh="8"/>
542
-
</g>
543
-
</item>
544
-
```
545
-
546
-
Enums are encoded using their ordinal values. Instances of `java.util.Date` are encoded as a long value representing epoch time. All other values are encoded via `toString()`. Unsupported (i.e. non-map) sequence elements are ignored.
547
-
548
453
## TemplateEncoder
549
454
The `TemplateEncoder` class transforms an object hierarchy into an output format using a [template document](template-reference.md). It provides the following constructors:
Note that modifiers must be thread-safe, since they are shared and may be invoked concurrently by multiple encoder instances.
635
540
636
541
## BeanAdapter
637
-
The `BeanAdapter` class implements the `Map` interface and exposes any properties defined by a bean as entries in the map, allowing custom data structures to be easily serialized to JSON, CSV, or XML.
542
+
The `BeanAdapter` class implements the `Map` interface and exposes any properties defined by a bean as entries in the map, allowing custom data structures to be easily serialized.
638
543
639
544
If a property value is `null` or an instance of one of the following types, it is returned as is:
The `ResultSetAdapter` classimplements the `Iterable` interfaceand makes each row in a JDBC result set appear as an instance of `Map`, allowing query results to be efficiently serialized as JSON, CSV, or XML, or to any other format via a template. `ResultSetAdapter` also implements `AutoCloseable` and ensures that the underlying result set is closed when the adapter itself is closed.
708
+
The `ResultSetAdapter` classimplements the `Iterable` interfaceand makes each row in a JDBC result set appear as an instance of `Map`, allowing query results to be efficiently serialized. `ResultSetAdapter` also implements `AutoCloseable` and ensures that the underlying result set is closed when the adapter itself is closed.
0 commit comments