当前位置: 首页>>代码示例>>Java>>正文


Java StringEscapeUtils.escapeHtml4方法代码示例

本文整理汇总了Java中org.apache.commons.text.StringEscapeUtils.escapeHtml4方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.escapeHtml4方法的具体用法?Java StringEscapeUtils.escapeHtml4怎么用?Java StringEscapeUtils.escapeHtml4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.text.StringEscapeUtils的用法示例。


在下文中一共展示了StringEscapeUtils.escapeHtml4方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: print

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Prints the.
 *
 * @param displayValue the display value
 * @param out the out
 * @throws JspException the jsp exception
 */
private void print(String displayValue, JspWriter out) throws JspException {
  try {
    if (maxLength != -1 && displayValue.length() > maxLength) {
      String newValue;
      if (ellipsisRight) {
        newValue = displayValue.substring(0, maxLength - 3) + "...";
      } else {
        newValue = "..." + displayValue.substring(displayValue.length() - maxLength + 3);
      }
      String title = StringEscapeUtils.escapeHtml4(displayValue);
      out.print("<span title=\"" + title + "\">" + newValue + "</span>");
    } else {
      out.print(displayValue);
    }
  } catch (IOException e) {
    throw new JspException(e);
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:26,代码来源:OutTag.java

示例2: createMessage

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
private static String createMessage(boolean stackTraceInWiki, String message) {
    String result = message;
    if (!stackTraceInWiki) {
        // Until https://github.com/unclebob/fitnesse/issues/731 is fixed
        if (message.contains("\n")) {
            if (!message.startsWith("<") || !message.endsWith(">")) {
                // it is not yet HTML, make it HTML so we can use <br/>
                message = StringEscapeUtils.escapeHtml4(message);
                message = String.format("<div>%s</div>", message);
            }
            message = message.replaceAll("(\\r)?\\n", "<br/>");
        }
        result = String.format("message:<<%s>>", message);
    }
    return result;
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:17,代码来源:SlimFixtureException.java

示例3: sanitizeForLog

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Sanitizes string for log.
 * @param msg message to sanitize
 * @return sanitized message
 */
public static String sanitizeForLog(String msg) {
  String clean = msg != null ?  msg.replace('\n', '_').replace('\r', '_') : "";
  clean = StringEscapeUtils.escapeHtml4(clean);
  if (!msg.equals(clean)) {
    clean += " (Encoded)";
  }
  return clean;
}
 
开发者ID:Esri,项目名称:geoportal-server-harvester,代码行数:14,代码来源:CrlfUtils.java

示例4: getTwitterAccordionPane

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
public static String getTwitterAccordionPane(String systemId) throws ServiceException, Exception {
	if ( StringUtils.isBlank(systemId) ) {
		return "";
	}
	SysTwitterVO sysTwitter = new SysTwitterVO();
	sysTwitter.setSystem( systemId );
	DefaultResult<SysTwitterVO> result = sysTwitterService.findByUK(sysTwitter);
	if ( result.getValue()==null ) {
		return "";
	}
	sysTwitter = result.getValue();
	if ( !YesNo.YES.equals(sysTwitter.getEnableFlag()) ) {
		return "";
	}
	String content = new String( sysTwitter.getContent(), "utf8" );
	if ( StringUtils.isBlank(content) ) {
		return "";
	}
	StringBuilder sb = new StringBuilder();
	String title = StringEscapeUtils.escapeHtml4( sysTwitter.getTitle() );
	String id = "_" + systemId + "_twitter_AccordionPane";
	sb.append("<div data-dojo-type=\"dijit/layout/AccordionPane\" title=\"<img src='./icons/twitter.png' border='0'/>&nbsp;" + title + "\" id=\"" + id + "\"> \n");
	sb.append(content);
	sb.append("\n");
	sb.append("</div>");
	return sb.toString();		
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:28,代码来源:MenuSupportUtils.java

示例5: getHtml

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Formats supplied value for display as pre-formatted text in FitNesse page.
 * @param formatter formatter to use to generate pre-formatted text.
 * @param value value to format.
 * @return HTML formatted version of value.
 */
public String getHtml(Formatter formatter, String value) {
    String result = null;
    if (value != null) {
        if ("".equals(value)) {
            result = "";
        } else {
            String formattedResponse = formatter.format(value);
            result = "<pre>" + StringEscapeUtils.escapeHtml4(formattedResponse) + "</pre>";
        }
    }
    return result;
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:19,代码来源:Environment.java

示例6: getTreeShowName

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
private String getTreeShowName(EmployeeVO employee) throws Exception {
	if ( !super.isBlank(employee.getJobTitle()) ) {
		return employee.getEmpId() + " - " + StringEscapeUtils.escapeHtml4(employee.getFullName()) + " ( " + employee.getJobTitle().trim() + " )";
	}
	return employee.getEmpId() + " - " + StringEscapeUtils.escapeHtml4(employee.getFullName());
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:7,代码来源:EmployeeLogicServiceImpl.java

示例7: formatExceptionMsg

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
protected String formatExceptionMsg(String value) {
    return StringEscapeUtils.escapeHtml4(value);
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:4,代码来源:BrowserTest.java

示例8: htmlEncode

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * HTML-escapes the String representation of the given Object.
 * @param object the Object.
 * @return an HTML-escaped String representation.
 */
public String htmlEncode( Object object )
{
    return object != null ? StringEscapeUtils.escapeHtml4( String.valueOf( object ) ) : null;
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:10,代码来源:Encoder.java

示例9: toString

import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
@Override public String toString() { return StringEscapeUtils.escapeHtml4(html); } 
开发者ID:emily-e,项目名称:webframework,代码行数:2,代码来源:SafeString.java


注:本文中的org.apache.commons.text.StringEscapeUtils.escapeHtml4方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。