org.sakaiproject.util.Web.encodeUrlsAsHtml()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.sakaiproject.util.Web.encodeUrlsAsHtml()方法的一些代码示例,展示了Web.encodeUrlsAsHtml()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Web.encodeUrlsAsHtml()方法的具体详情如下:
包路径:org.sakaiproject.util.Web
类名称:Web
方法名:encodeUrlsAsHtml

Web.encodeUrlsAsHtml介绍

[英]For converting plain-text URLs in a String to HTML <a> tags Any URLs in the source text that happen to be already in a <a> tag will be unaffected.
[中]对于将字符串中的纯文本URL转换为HTML<a>标记,源文本中碰巧已在<a>标记中的任何URL都不会受到影响。

代码示例

代码示例来源:origin: sakaiproject/sakai

protected String htmlContent(Event event) {
  return Web.encodeUrlsAsHtml(Web.escapeHtml(plainTextContent(event),true));
}

代码示例来源:origin: org.sakaiproject.mailarchive/sakai-mailarchive-impl

/**
 * Get the formatted body (either html or plain-text converted to html), as a string.
 * 
 * @return The formatted body as a string.
 */
public String getFormattedBody()
{
  if ( getHtmlBody() != null && getHtmlBody().length() > 0 )
    return m_html_body;
  else 
    return Web.encodeUrlsAsHtml( FormattedText.convertPlaintextToFormattedText(m_body) );
    
} // getHtmlBody

相关文章