Example usage for org.apache.commons.lang StringEscapeUtils escapeHtml

List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml

Introduction

In this page you can find the example usage for org.apache.commons.lang StringEscapeUtils escapeHtml.

Prototype

public static String escapeHtml(String input) 

Source Link

Usage

From source file:ch.systemsx.cisd.openbis.generic.shared.translator.AttachmentTranslator.java

public final static Attachment translate(final AttachmentPE attachment) {
    if (attachment == null) {
        return null;
    }/*from w w w. j  a va 2 s  .  c om*/
    final Attachment result = new Attachment();
    result.setFileName(StringEscapeUtils.escapeHtml(attachment.getFileName()));
    result.setTitle(StringEscapeUtils.escapeHtml(attachment.getTitle()));
    result.setDescription(StringEscapeUtils.escapeHtml(attachment.getDescription()));
    result.setRegistrator(PersonTranslator.translate(attachment.getRegistrator()));
    result.setRegistrationDate(attachment.getRegistrationDate());
    result.setVersion(attachment.getVersion());
    return result;
}

From source file:de.griffel.confluence.plugins.plantuml.GraphVizUtils.java

/**
 * Converts the given string to a dot label string.
 *
 * @param s the string that should be used a label string.
 * @return dot label string.//w w w.  ja  va2s  . c om
 * @see http://www.graphviz.org/doc/info/attrs.html#k:lblString
 */
public static String toNodeLabel(String s) {
    // HTML-escape the string twice since it will be unwrapped once in PlantUmlMacro#execute(...)
    return StringEscapeUtils.escapeHtml(StringEscapeUtils.escapeHtml(s));
}

From source file:ch.systemsx.cisd.openbis.generic.shared.translator.GroupTranslator.java

public static Group translate(final GroupPE group) {
    if (group == null) {
        return null;
    }/*from w w  w  .  j  a v a  2  s.c  o m*/
    final Group result = new Group();
    result.setId(HibernateUtils.getId(group));
    result.setCode(StringEscapeUtils.escapeHtml(group.getCode()));
    result.setDescription(StringEscapeUtils.escapeHtml(group.getDescription()));
    result.setInstance(DatabaseInstanceTranslator.translate(group.getDatabaseInstance()));
    result.setRegistrationDate(group.getRegistrationDate());
    result.setRegistrator(PersonTranslator.translate(group.getRegistrator()));
    result.setIdentifier(
            StringEscapeUtils.escapeHtml(IdentifierHelper.createGroupIdentifier(group).toString()));
    return result;
}

From source file:gov.nih.nci.ncicb.cadsr.contexttree.BaseTreeNode.java

public String getJsFunctionName() {
    String functionName = (String) treeParams.get(FUNCTION_NAME_URL_PARAM);
    if (functionName == null)
        functionName = "performAction";
    return StringEscapeUtils.escapeHtml(functionName);
}

From source file:ch.systemsx.cisd.openbis.generic.shared.translator.PersonTranslator.java

private final static Person translate(final PersonPE person, final boolean recursively) {
    if (person == null) {
        return null;
    }//w  ww.j a va2 s .  co m
    final Person result = new Person();
    result.setFirstName(StringEscapeUtils.escapeHtml(person.getFirstName()));
    result.setLastName(StringEscapeUtils.escapeHtml(person.getLastName()));
    result.setEmail(StringEscapeUtils.escapeHtml(person.getEmail()));
    result.setUserId(StringEscapeUtils.escapeHtml(person.getUserId()));
    result.setRegistrationDate(person.getRegistrationDate());
    if (recursively) {
        result.setRegistrator(PersonTranslator.translate(person.getRegistrator(), false));
    }
    return result;
}

From source file:com.switchfly.inputvalidation.sanitizer.HtmlSanitizer.java

@Override
public String execute(String content) {
    return StringEscapeUtils.escapeHtml(content);
}

From source file:com.kstenschke.shifter.models.shiftertypes.StringHtmlEncodable.java

/**
 * Shift to HTML encoded/decoded variant of given string
 *
 * @param word word to be shifted//from   ww  w. j ava  2  s .c  o  m
 * @return String
 */
public static String getShifted(String word) {
    Integer strLenOriginal = word.length();

    String decoded = StringEscapeUtils.unescapeHtml(word);
    Integer strLenDecoded = decoded.length();

    if (!strLenOriginal.equals(strLenDecoded))
        return decoded;

    String encoded = StringEscapeUtils.escapeHtml(word);
    Integer strLenEncoded = encoded.length();

    if (!strLenOriginal.equals(strLenEncoded))
        return encoded;

    return word;
}

From source file:edu.harvard.iq.dataverse.util.MarkupChecker.java

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

From source file:ch.systemsx.cisd.openbis.generic.shared.translator.AuthorizationGroupTranslator.java

public static AuthorizationGroup translate(final AuthorizationGroupPE group) {
    if (group == null) {
        return null;
    }//  www  .j ava 2s . co m
    final AuthorizationGroup result = new AuthorizationGroup();
    result.setId(HibernateUtils.getId(group));
    result.setCode(StringEscapeUtils.escapeHtml(group.getCode()));
    result.setDescription(StringEscapeUtils.escapeHtml(group.getDescription()));
    result.setDatabaseInstance(DatabaseInstanceTranslator.translate(group.getDatabaseInstance()));
    result.setRegistrationDate(group.getRegistrationDate());
    result.setRegistrator(PersonTranslator.translate(group.getRegistrator()));
    return result;
}

From source file:at.gv.egovernment.moa.id.util.legacy.LegacyHelper.java

public static boolean isUseMandateRequested(HttpServletRequest req) throws WrongParametersException {

    String useMandate = req.getParameter(PARAM_USEMANDATE);
    useMandate = StringEscapeUtils.escapeHtml(useMandate);
    if (!ParamValidatorUtils.isValidUseMandate(useMandate))
        throw new WrongParametersException("StartAuthentication", PARAM_USEMANDATE, "auth.12");

    //check UseMandate flag
    String useMandateString = null;
    if ((useMandate != null) && (useMandate.compareTo("") != 0)) {
        useMandateString = useMandate;/* www  .  j  ava 2  s. c om*/
    } else {
        useMandateString = "false";
    }

    if (useMandateString.compareToIgnoreCase("true") == 0)
        return true;
    else
        return false;
}