keycloak
静的公開メンバ関数 | 全メンバ一覧
org.keycloak.common.util.HtmlUtils クラス
org.keycloak.common.util.HtmlUtils 連携図
Collaboration graph

静的公開メンバ関数

static String escapeAttribute (String value)
 

詳解

著者
pedroigor

関数詳解

◆ escapeAttribute()

static String org.keycloak.common.util.HtmlUtils.escapeAttribute ( String  value)
inlinestatic

Escapes the value for a HTML element attribute.

引数
value
戻り値
30  {
31  StringBuilder escaped = new StringBuilder();
32 
33  for (int i = 0; i < value.length(); i++) {
34  char chr = value.charAt(i);
35 
36  if (chr == '<') {
37  escaped.append("&lt;");
38  } else if (chr == '>') {
39  escaped.append("&gt;");
40  } else if (chr == '"') {
41  escaped.append("&quot;");
42  } else if (chr == '\'') {
43  escaped.append("&apos;");
44  } else if (chr == '&') {
45  escaped.append("&amp;");
46  } else {
47  escaped.append(chr);
48  }
49  }
50 
51  return escaped.toString();
52  }

このクラス詳解は次のファイルから抽出されました: