Example usage for org.apache.commons.lang3 StringEscapeUtils escapeHtml4

List of usage examples for org.apache.commons.lang3 StringEscapeUtils escapeHtml4

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringEscapeUtils escapeHtml4.

Prototype

public static final String escapeHtml4(final String input) 

Source Link

Document

Escapes the characters in a String using HTML entities.

For example:

"bread" & "butter"

becomes:

"bread" & "butter".

Usage

From source file:com.yilang.commons.utils.util.Encodes.java

public static String escapeHtml(String html) {
    return StringEscapeUtils.escapeHtml4(html);
}

From source file:es.ait.gp.web.util.jsf.HTMLTextConverter.java

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
    if (value == null) {
        return "";
    }// ww w.j  a va 2s.  co  m

    return StringEscapeUtils.escapeHtml4(value.toString()).replaceAll("\n", "<br/>");
}

From source file:com.hj.blog.common.utils.StringUtils.java

static String escapeHtml(String html) {
    return StringEscapeUtils.escapeHtml4(html);
}

From source file:de.akra.idocit.java.services.JavadocGenerator.java

public static String quoteGenericsInIdentifier(String identifier) {
    return StringEscapeUtils.escapeHtml4(identifier);
}

From source file:com.oakhole.utils.StringUtils.java

public static String escapeHtml(String text) {
    return StringEscapeUtils.escapeHtml4(text);
}

From source file:com.nhncorp.lucy.security.xss.XssPreventer.java

/**
 * ?  XSS({@code Cross Site Scripting}) ??  ?  
 *      ? ./*from www. java  2  s. c  om*/
 *  ? XssFilter, XssSaxFilter  ???    ??.  
 * 
 * @param dirty
 *            XSS({@code Cross Site Scripting})? ??  .            
 * @return    .
 */
public static String escape(String dirty) {

    String clean = StringEscapeUtils.escapeHtml4(dirty);

    if (clean == null) {
        return null;
    }

    Matcher matcher = escapePattern.matcher(clean);

    if (matcher.find()) {
        return matcher.replaceAll("&#39;");
    }

    return clean;
}

From source file:de.blizzy.documentr.markdown.macro.impl.ColorMacro.java

@Override
public String getHtml(IMacroContext macroContext) {
    String color = macroContext.getParameters();
    return "<span style=\"color: " + StringEscapeUtils.escapeHtml4(color) + ";\">" + //$NON-NLS-1$ //$NON-NLS-2$
            macroContext.getBody() + "</span>"; //$NON-NLS-1$
}

From source file:apm.common.utils.Encodes.java

/**
 * Html ?.
 */
public static String escapeHtml(String html) {
    return StringEscapeUtils.escapeHtml4(html);
}

From source file:de.elbe5.base.util.StringUtil.java

public static String toHtml(String src) {
    if (src == null) {
        return "";
    }/*from   w  ww. j a  va2s  .co  m*/
    return StringEscapeUtils.escapeHtml4(src);
}

From source file:baggage.hypertoolkit.html.Attribute.java

public Attribute(String name, String value) {
    this.name = StringEscapeUtils.escapeHtml4(name);
    this.value = StringEscapeUtils.escapeHtml4(value);
}