Skip to content

Commit 2bde432

Browse files
author
litongjava
committed
add #escape to avoid xxs
1 parent 6c83421 commit 2bde432

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

frameworks/Java/tio-server/src/main/java/com/litongjava/tio/http/server/controller/DbController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public HttpResponse fortunes(HttpRequest request) throws IllegalAccessException,
112112
fortunes.add(BeanConverterUtils.toBean(record.toMap(), Fortune.class));
113113
}
114114
// 添加额外的 Fortune
115-
fortunes.add(new Fortune(0, "Additional fortune added at request time."));
115+
fortunes.add(new Fortune(0L, "Additional fortune added at request time."));
116116

117117
// 按照消息排序
118118
fortunes.sort(Comparator.comparing(Fortune::getMessage));

frameworks/Java/tio-server/src/main/java/com/litongjava/tio/http/server/model/Fortune.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
public final class Fortune {
44

5-
public Integer id;
5+
public Long id;
66
public String message;
77

88
public Fortune() {
99
}
1010

11-
public Fortune(Integer id, String message) {
11+
public Fortune(Long id, String message) {
1212
this.id = id;
1313
this.message = message;
1414
}
1515

16-
public Integer getId() {
16+
public Long getId() {
1717
return id;
1818
}
1919

frameworks/Java/tio-server/src/main/resources/templates/fortunes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#for(fortune : fortunes)
1313
<tr>
1414
<td>#(fortune.id)</td>
15-
<td>#(fortune.message)</td>
15+
<td>#escape(fortune.message)</td>
1616
</tr>
1717
#end
1818
</table>

0 commit comments

Comments
 (0)