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.enonic.cms.core.portal.rendering.PortletErrorMessageMarkupCreator.java

private String getDetails(final Exception e) {
    Throwable error = e;// www . j  a  va2  s  .  c  o m
    final StringWriter writer = new StringWriter();

    if (error instanceof PortletXsltViewTransformationException) {
        error = error.getCause();
    }

    error.printStackTrace(new PrintWriter(writer));
    return StringEscapeUtils.escapeHtml(writer.toString());
}

From source file:mitm.djigzo.web.components.TextFragmentMarkup.java

@BeginRender
void beginRender(MarkupWriter writer) {
    String markedupValue = fragmentMarkupRender.renderMarkup(StringEscapeUtils.escapeHtml(value),
            fragmentRegistry);

    writer.writeRaw(markedupValue);
}

From source file:com.alibaba.jstorm.ui.controller.JStackController.java

@RequestMapping(value = "/jstack", method = RequestMethod.GET)
public String show(@RequestParam(value = "cluster", required = true) String clusterName,
        @RequestParam(value = "host", required = true) String host,
        @RequestParam(value = "port", required = true) String logServerPort,
        @RequestParam(value = "wport", required = true) String workerPort, ModelMap model) {
    clusterName = StringEscapeUtils.escapeHtml(clusterName);
    int i_logServerPort = JStormUtils.parseInt(logServerPort);
    int i_workerPort = JStormUtils.parseInt(workerPort);

    requestJStack(host, i_logServerPort, i_workerPort, model);
    model.addAttribute("clusterName", clusterName);
    return "jstack";
}

From source file:com.board.games.handler.discuz.DiscuzPokerLoginServiceImpl.java

public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
    String password = "lollol";
    String members_pass_salt = "bde24b";
    String members_pass_hash = "7ff84fb011b72abcff4bf75084478d7b";
    String escapePwdHTML = StringEscapeUtils.escapeHtml(password);
    System.out.println("escapeHTML = " + escapePwdHTML);

    //String pwdSha1 = getSha1(user.toLowerCase()+password);

    //log.debug("pwdSha1 = " + pwdSha1);
    System.out.println("members_pass_salt " + members_pass_salt);

    String pwdMD5 = getMD5(getMD5(password) + members_pass_salt);

    System.out.println("pwdMD5 = " + pwdMD5);

    if (pwdMD5 != null && members_pass_hash != null) {
        if (pwdMD5.equals(members_pass_hash)) {
            System.out.println("Password successfully matched");
        } else {//from   w  ww .  j a v a2  s .co m
            System.out.println("Failed");
        }
    }
}

From source file:com.alibaba.jstorm.ui.controller.ZookeeperController.java

@RequestMapping(value = "/zookeeper", method = RequestMethod.GET)
public String show(@RequestParam(value = "name", required = true) String name, ModelMap model) {
    name = StringEscapeUtils.escapeHtml(name);
    long start = System.currentTimeMillis();
    try {// w  w  w .j a v  a 2s .c o m
        ClusterConfig config = UIUtils.clusterConfig.get(name);
        StringBuilder builder = new StringBuilder("");
        for (String ip : config.getZkServers()) {
            builder.append(ip).append(",");
        }
        builder.deleteCharAt(builder.length() - 1);
        builder.append(":");
        builder.append(config.getZkPort());
        model.addAttribute("zkRoot", config.getZkRoot());
        model.addAttribute("zkServers", builder.toString());
        model.addAttribute("clusterName", name);
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        UIUtils.addErrorAttribute(model, e);
    }

    LOG.info("zookeeper page show cost:{}ms", System.currentTimeMillis() - start);
    return "zookeeper";
}

From source file:com.ultrapower.eoms.common.plugin.ecside.tag.TagUtils.java

 public final static String escapeString(String value, String escapeType){
   if ("html".equals(escapeType)){
      value=StringEscapeUtils.escapeHtml(value);
   }else if ("xml".equals(escapeType)){
      value=StringEscapeUtils.escapeXml(value);
   }else if ("js".equals(escapeType)){
      value=StringEscapeUtils.escapeJavaScript(value);
   }/* w  ww.j  a  va2s  .c o  m*/
   return value;
}

From source file:gov.nih.nci.calims2.uic.html.TagRenderer.java

private String getFormattedContent(ContentTag contentTag) {
    switch (contentTag.getContentType()) {
    case CDATA: {
        return "<![CDATA[" + contentTag.getContent() + "]]>";
    }/*  ww w .  ja v  a  2  s .  c  om*/
    case COMMENTED_CDATA: {
        return "//<![CDATA[\n" + contentTag.getContent() + "\n//]]>";
    }
    case HTML: {
        return StringEscapeUtils.escapeHtml(contentTag.getContent());
    }
    case TEXT: {
        return contentTag.getContent();
    }
    default: {
        throw new IllegalArgumentException("Missing contentType");
    }
    }
}

From source file:co.cask.cdap.logging.gateway.handlers.TextOffsetCallback.java

@Override
protected Object encodeSend(LogEvent event) {
    String log = patternLayout.doLayout(event.getLoggingEvent());
    log = escape ? StringEscapeUtils.escapeHtml(log) : log;
    return new FormattedTextLogEvent(log, event.getOffset());
}

From source file:com.redhat.rhn.frontend.dto.MultiOrgAllUserOverview.java

/**
 * get the user login
 * @return the user login
 */
public String getUserLogin() {
    return StringEscapeUtils.escapeHtml(userLogin);
}

From source file:com.benfante.minimark.util.TextFilterUtils.java

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