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:com.cruta.hecas.socket.NotifyView.java

public void send() {
    EventBus eventBus = EventBusFactory.getDefault().eventBus();
    eventBus.publish(CHANNEL,/*from  w w w.  j  a v a2 s  .  co m*/
            new FacesMessage(StringEscapeUtils.escapeHtml(summary), StringEscapeUtils.escapeHtml(detail)));
}

From source file:com.laxser.blitz.web.instruction.HttpErrorInstruction.java

@Override
public void doRender(Invocation inv) throws Exception {
    String message = resolvePlaceHolder(this.message, inv);
    message = StringEscapeUtils.escapeHtml(message); //??HTMLXSS
    if (StringUtils.isEmpty(message)) {
        inv.getResponse().sendError(code);
    } else {/*from  ww w  . j  a v  a2 s . com*/
        inv.getResponse().sendError(code, message);
    }
}

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

public final static Material translate(final MaterialPE materialPE, final boolean withProperties) {
    if (materialPE == null) {
        return null;
    }/*  w  w  w. j a va2s  . c o m*/
    final Material result = new Material();
    result.setCode(StringEscapeUtils.escapeHtml(materialPE.getCode()));
    result.setId(HibernateUtils.getId(materialPE));
    result.setModificationDate(materialPE.getModificationDate());
    result.setMaterialType(MaterialTypeTranslator.translate(materialPE.getMaterialType(),
            new HashMap<PropertyTypePE, PropertyType>()));
    result.setDatabaseInstance(DatabaseInstanceTranslator.translate(materialPE.getDatabaseInstance()));
    result.setRegistrator(PersonTranslator.translate(materialPE.getRegistrator()));
    result.setRegistrationDate(materialPE.getRegistrationDate());
    if (withProperties) {
        setProperties(materialPE, result);
    }
    return result;
}

From source file:ar.com.tadp.xml.rinzo.core.model.visitor.EscapeHTMLVisitor.java

protected String escape(String value) {
    return StringEscapeUtils.escapeHtml(value);
}

From source file:net.riezebos.thoth.util.ThothCoreUtil.java

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

From source file:edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel.java

protected void setText(String text) {
    this.text = StringEscapeUtils.escapeHtml(text);
}

From source file:gov.nih.nci.calims2.taglib.EnumTag.java

/**
 * {@inheritDoc}/*from  www .ja va 2 s  .  c  om*/
 */
public int doStartTag() throws JspException {
    try {
        Locale locale = TagHelper.getRequestContext(pageContext).getLocale();
        if (value != null) {
            String message = (propertyName == null) ? value.getLocalizedValue(locale)
                    : getPropertyValue(locale);
            pageContext.getOut().print(StringEscapeUtils.escapeHtml(message));
        }
        return SKIP_BODY;
    } catch (IOException e) {
        throw new JspException(e);
    } catch (Exception e) {
        throw new JspTagException(e);
    }
}

From source file:com.github.rnewson.couchdb.lucene.Utils.java

public static String error(final int code, final String txt) {
    return new JSONObject().element("code", code).element("body", StringEscapeUtils.escapeHtml(txt)).toString();
}

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

public final static IEntityProperty translate(final EntityPropertyPE propertyPE,
        Map<PropertyTypePE, PropertyType> cacheOrNull) {
    final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(propertyPE);
    final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode);
    result.setPropertyType(PropertyTypeTranslator
            .translate(propertyPE.getEntityTypePropertyType().getPropertyType(), cacheOrNull));
    switch (typeCode) {
    case CONTROLLEDVOCABULARY:
        result.setVocabularyTerm(VocabularyTermTranslator.translate(propertyPE.getVocabularyTerm()));
        break;/*from   w  w  w  .j a  v  a2  s.  c o m*/
    case MATERIAL:
        result.setMaterial(MaterialTranslator.translate(propertyPE.getMaterialValue(), false));
        break;
    default:
        result.setValue(StringEscapeUtils.escapeHtml(propertyPE.tryGetUntypedValue()));
    }
    return result;
}

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

public final static Experiment translate(final ExperimentPE experiment, String baseIndexURL,
        final LoadableFields... withFields) {
    if (experiment == null) {
        return null;
    }/*from w  w  w  .j  ava 2s  .  c om*/
    final Experiment result = new Experiment();
    result.setId(HibernateUtils.getId(experiment));
    result.setModificationDate(experiment.getModificationDate());
    result.setCode(StringEscapeUtils.escapeHtml(experiment.getCode()));
    result.setPermId(StringEscapeUtils.escapeHtml(experiment.getPermId()));
    result.setPermlink(
            PermlinkUtilities.createPermlinkURL(baseIndexURL, EntityKind.EXPERIMENT, experiment.getPermId()));
    result.setExperimentType(translate(experiment.getExperimentType()));
    result.setIdentifier(StringEscapeUtils.escapeHtml(experiment.getIdentifier()));
    result.setProject(ProjectTranslator.translate(experiment.getProject()));
    result.setRegistrationDate(experiment.getRegistrationDate());
    result.setRegistrator(PersonTranslator.translate(experiment.getRegistrator()));
    result.setInvalidation(InvalidationTranslator.translate(experiment.getInvalidation()));
    for (final LoadableFields field : withFields) {
        switch (field) {
        case PROPERTIES:
            setProperties(experiment, result);
            break;
        case ATTACHMENTS:
            result.setAttachments(AttachmentTranslator.translate(experiment.getAttachments()));
            break;
        default:
            break;
        }
    }
    return result;
}