diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java index fdf96ca1bf1..3cac0b07bbe 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,19 @@ package org.springframework.web.util; import org.springframework.util.Assert; /** - * Utility class for HTML escaping. Escapes and unescapes - * based on the W3C HTML 4.01 recommendation, handling + * Utility class for HTML escaping. + * + *
Escapes and unescapes based on the W3C HTML 4.01 recommendation, handling * character entity references. * *
Reference: * https://www.w3.org/TR/html4/charset.html * - *
For a comprehensive set of String escaping utilities, - * consider Apache Commons Lang and its StringEscapeUtils class. - * We are not using that class here to avoid a runtime dependency - * on Commons Lang just for HTML escaping. Furthermore, Spring's - * HTML escaping is more flexible and 100% HTML 4.0 compliant. + *
For a comprehensive set of String escaping utilities, consider + * Apache Commons Text + * and its {@code StringEscapeUtils} class. We do not use that class here in order + * to avoid a runtime dependency on Commons Text just for HTML escaping. Furthermore, + * Spring's HTML escaping is more flexible and 100% HTML 4.0 compliant. * * @author Juergen Hoeller * @author Martin Kersten @@ -48,7 +49,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding * entity reference (e.g. {@code <}). *
Reference: @@ -64,7 +65,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding * entity reference (e.g. {@code <}) at least as required by the * specified encoding. In other words, if a special character does @@ -97,7 +98,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding numeric * reference in decimal format (Decimal;). *
Reference: @@ -113,7 +114,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding numeric * reference in decimal format (Decimal;) at least as required by the * specified encoding. In other words, if a special character does @@ -147,7 +148,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding numeric * reference in hex format (Hex;). *
Reference: @@ -163,7 +164,7 @@ public abstract class HtmlUtils { /** * Turn special characters into HTML character references. - * Handles complete character set defined in HTML 4.01 recommendation. + *
Handles complete character set defined in HTML 4.01 recommendation. *
Escapes all special characters to their corresponding numeric
* reference in hex format (Hex;) at least as required by the
* specified encoding. In other words, if a special character does
@@ -205,8 +206,8 @@ public abstract class HtmlUtils {
* &#Decimal; - (Example: D)
* &#xHex; - (Example: å) case insensitive
*
- * Gracefully handles malformed character references by copying original
- * characters as is when encountered.
+ *
Gracefully handles malformed character references by copying original + * characters as is when encountered. *
Reference: * * https://www.w3.org/TR/html4/sgml/entities.html