Skip to content

Commit d18d4d8

Browse files
committed
Update Javadoc for HtmlUtils regarding Apache Commons Text
Closes gh-23122
1 parent 108ce58 commit d18d4d8

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,18 +19,19 @@
1919
import org.springframework.util.Assert;
2020

2121
/**
22-
* Utility class for HTML escaping. Escapes and unescapes
23-
* based on the W3C HTML 4.01 recommendation, handling
22+
* Utility class for HTML escaping.
23+
*
24+
* <p>Escapes and unescapes based on the W3C HTML 4.01 recommendation, handling
2425
* character entity references.
2526
*
2627
* <p>Reference:
2728
* <a href="http://www.w3.org/TR/html4/charset.html">http://www.w3.org/TR/html4/charset.html</a>
2829
*
29-
* <p>For a comprehensive set of String escaping utilities,
30-
* consider Apache Commons Lang and its StringEscapeUtils class.
31-
* We are not using that class here to avoid a runtime dependency
32-
* on Commons Lang just for HTML escaping. Furthermore, Spring's
33-
* HTML escaping is more flexible and 100% HTML 4.0 compliant.
30+
* <p>For a comprehensive set of String escaping utilities, consider
31+
* <a href="https://commons.apache.org/proper/commons-text/">Apache Commons Text</a>
32+
* and its {@code StringEscapeUtils} class. We do not use that class here in order
33+
* to avoid a runtime dependency on Commons Text just for HTML escaping. Furthermore,
34+
* Spring's HTML escaping is more flexible and 100% HTML 4.0 compliant.
3435
*
3536
* @author Juergen Hoeller
3637
* @author Martin Kersten
@@ -48,7 +49,7 @@ public abstract class HtmlUtils {
4849

4950
/**
5051
* Turn special characters into HTML character references.
51-
* Handles complete character set defined in HTML 4.01 recommendation.
52+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
5253
* <p>Escapes all special characters to their corresponding
5354
* entity reference (e.g. {@code &lt;}).
5455
* <p>Reference:
@@ -64,7 +65,7 @@ public static String htmlEscape(String input) {
6465

6566
/**
6667
* Turn special characters into HTML character references.
67-
* Handles complete character set defined in HTML 4.01 recommendation.
68+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
6869
* <p>Escapes all special characters to their corresponding
6970
* entity reference (e.g. {@code &lt;}) at least as required by the
7071
* specified encoding. In other words, if a special character does
@@ -97,7 +98,7 @@ public static String htmlEscape(String input, String encoding) {
9798

9899
/**
99100
* Turn special characters into HTML character references.
100-
* Handles complete character set defined in HTML 4.01 recommendation.
101+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
101102
* <p>Escapes all special characters to their corresponding numeric
102103
* reference in decimal format (&#<i>Decimal</i>;).
103104
* <p>Reference:
@@ -113,7 +114,7 @@ public static String htmlEscapeDecimal(String input) {
113114

114115
/**
115116
* Turn special characters into HTML character references.
116-
* Handles complete character set defined in HTML 4.01 recommendation.
117+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
117118
* <p>Escapes all special characters to their corresponding numeric
118119
* reference in decimal format (&#<i>Decimal</i>;) at least as required by the
119120
* specified encoding. In other words, if a special character does
@@ -147,7 +148,7 @@ public static String htmlEscapeDecimal(String input, String encoding) {
147148

148149
/**
149150
* Turn special characters into HTML character references.
150-
* Handles complete character set defined in HTML 4.01 recommendation.
151+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
151152
* <p>Escapes all special characters to their corresponding numeric
152153
* reference in hex format (&#x<i>Hex</i>;).
153154
* <p>Reference:
@@ -163,7 +164,7 @@ public static String htmlEscapeHex(String input) {
163164

164165
/**
165166
* Turn special characters into HTML character references.
166-
* Handles complete character set defined in HTML 4.01 recommendation.
167+
* <p>Handles complete character set defined in HTML 4.01 recommendation.
167168
* <p>Escapes all special characters to their corresponding numeric
168169
* reference in hex format (&#x<i>Hex</i>;) at least as required by the
169170
* specified encoding. In other words, if a special character does
@@ -205,8 +206,8 @@ public static String htmlEscapeHex(String input, String encoding) {
205206
* &amp;#<i>Decimal</i>; - <i>(Example: &amp;#68;)</i><br>
206207
* &amp;#x<i>Hex</i>; - <i>(Example: &amp;#xE5;) case insensitive</i><br>
207208
* </blockquote>
208-
* Gracefully handles malformed character references by copying original
209-
* characters as is when encountered.<p>
209+
* <p>Gracefully handles malformed character references by copying original
210+
* characters as is when encountered.
210211
* <p>Reference:
211212
* <a href="http://www.w3.org/TR/html4/sgml/entities.html">
212213
* http://www.w3.org/TR/html4/sgml/entities.html

0 commit comments

Comments
 (0)