Skip to content

Commit f4cceef

Browse files
committed
Update README.md.
1 parent 841b6cb commit f4cceef

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ HTTP-RPC is an open-source framework for implementing RESTful and REST-like web
66

77
This guide introduces the HTTP-RPC framework and provides an overview of its key features.
88

9-
# Feedback
10-
Feedback is welcome and encouraged. Please feel free to [contact me](mailto:gk_brown@icloud.com?subject=HTTP-RPC) with any questions, comments, or suggestions. Also, if you like using HTTP-RPC, please consider [starring](https://github.com/gk-brown/HTTP-RPC/stargazers) it!
11-
129
# Contents
1310
* [Getting HTTP-RPC](#getting-http-rpc)
1411
* [HTTP-RPC Classes](#http-rpc-classes)
@@ -560,7 +557,7 @@ would produce the following output:
560557
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.
561558

562559
## TemplateEncoder
563-
The `TemplateEncoder` class is responsible for merging a [template document](template-reference.md) with a data dictionary. It provides the following constructors:
560+
The `TemplateEncoder` class transforms an object hierarchy into an output format using a [template document](template-reference.md). It provides the following constructors:
564561

565562
```java
566563
public TemplateEncoder(URL url) { ... }
@@ -585,10 +582,10 @@ public Map<String, Object> getContext() { ... }
585582
Templates are applied using one of the following methods:
586583

587584
```java
588-
public void writeValue(Object value, OutputStream outputStream) { ... }
589-
public void writeValue(Object value, OutputStream outputStream, Locale locale) { ... }
590-
public void writeValue(Object value, Writer writer) { ... }
591-
public void writeValue(Object value, Writer writer, Locale locale) { ... }
585+
public void write(Object value, OutputStream outputStream) { ... }
586+
public void write(Object value, OutputStream outputStream, Locale locale) { ... }
587+
public void write(Object value, Writer writer) { ... }
588+
public void write(Object value, Writer writer, Locale locale) { ... }
592589
```
593590

594591
The first argument represents the value to write (i.e. the data dictionary), and the second the output destination. The optional third argument represents the locale for which the template will be applied. If unspecified, the default locale is used.
@@ -606,7 +603,7 @@ TemplateEncoder encoder = new TemplateEncoder(getClass().getResource("map.txt"),
606603

607604
String result;
608605
try (StringWriter writer = new StringWriter()) {
609-
encoder.writeValue(map, writer);
606+
encoder.write(map, writer);
610607

611608
result = writer.toString();
612609
}
@@ -633,7 +630,7 @@ Modifiers are created by implementing the `TemplateEncoder.Modifier` interface,
633630
public Object apply(Object value, String argument, Locale locale);
634631
```
635632

636-
The first argument to this method represents the value to be modified, and the second is the optional argument value following the `=` character in the modifier string. If an argument is not specified, this value will be `null`. The third argument contains the encoder's locale.
633+
The first argument to this method represents the value to be modified, and the second is the optional argument value following the "=" character in the modifier string. If an argument is not specified, this value will be `null`. The third argument contains the encoder's locale.
637634

638635
For example, the following code creates a modifier that converts values to uppercase:
639636

template-reference.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Variable names represent keys into the data dictionary. When the template is pro
2323

2424
Nested values can be referred to using path notation; e.g. "name.first". Missing (i.e. `null`) values are replaced with the empty string in the generated output.
2525

26-
Variable names beginning with "@" represent resource references, and are replaced with the corresponding values from the provided resource bundle when the template is processed.
26+
Variable names beginning with "@" represent resource references, and are replaced with the corresponding values from the resource bundle when the template is processed.
2727

28-
Variable names beginning with "$" represent context references, and are replaced with the corresponding values from the provided context dictionary when the template is processed.
28+
Variable names beginning with "$" represent context references, and are replaced with the corresponding values from the template context when the template is processed.
2929

3030
### Modifiers
3131
Modifiers are used to transform a variable's representation before it is written to the output stream; for example, to apply an escape sequence.
@@ -39,7 +39,7 @@ Modifiers are specified as shown below. They are invoked in order from left to r
3939
All templates support the following set of standard modifiers:
4040

4141
* `format` - applies a [format string](https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html#syntax)
42-
* `^html`, `^xml` - applies markup encoding to a value
42+
* `^html` - applies HTML encoding to a value
4343
* `^url` - applies URL encoding to a value
4444

4545
For example, the following marker applies a format string to a value and then URL-encodes the result:
@@ -122,7 +122,7 @@ For example, a data dictionary that contains information about homes for sale mi
122122
}
123123
```
124124

125-
A template to present these results in an HTML table is shown below. The section markers are enclosed in HTML comments so they will be ignored by syntax-aware text editors, and will simply resolve to empty comment blocks when the template is processed:
125+
A template to transform these results into HTML is shown below. The section markers are enclosed in HTML comments so they will be ignored by syntax-aware text editors, and will simply resolve to empty comment blocks when the template is processed:
126126

127127
```html
128128
<table>
@@ -137,7 +137,9 @@ A template to present these results in an HTML table is shown below. The section
137137
</table>
138138
```
139139

140-
A dot character (".") can be used to represent the current element in a sequence. This can be useful when rendering scalar values. A dot can also be used to represent the sequence itself; for example, when a sequence is the root object:
140+
A dot character (".") can be used to represent the current element in a sequence. This can be useful when rendering scalar values.
141+
142+
A dot can also be used to represent the sequence itself; for example, when a sequence is the root object:
141143

142144
```
143145
{{#.}}
@@ -174,7 +176,9 @@ Hello, World!
174176
Includes inherit their context from the parent document, so they can refer to elements in the parent's data dictionary. This allows includes to be parameterized. Self-referencing includes can also be used to facilitate recursion.
175177

176178
## Comments
177-
Comment markers provide informational text about a template's content. They are not included in the final output. For example, when the following template is processed, only the content between the `<p>` tags will be included:
179+
Comment markers provide informational text about a template's content. They are not included in the final output.
180+
181+
For example, when the following template is processed, only the content between the `<p>` tags will be included:
178182

179183
```
180184
{{! Some placeholder text }}

0 commit comments

Comments
 (0)