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:gov.nih.nci.ncicb.cadsr.contexttree.BaseTreeNode.java

public String getFormJsFunctionName() {
    String functionName = "performAction";
    if (this.FORM_SEARCH_TREE.equals(this.getTreeType()))
        functionName = this.FORM_DETAILS_FUNCTION;
    else//from   w ww  .  j  a  v  a 2s .com
        functionName = (String) treeParams.get(FUNCTION_NAME_URL_PARAM);
    if (functionName == null)
        functionName = "performAction";
    return StringEscapeUtils.escapeHtml(functionName);
}

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

@RequestMapping(value = "/cluster", method = RequestMethod.GET)
public String show(@RequestParam(value = "name", required = true) String name, ModelMap model) {
    name = StringEscapeUtils.escapeHtml(name);
    long start = System.currentTimeMillis();
    NimbusClient client = null;//from  w  ww.j av  a2s. c  o m
    try {
        client = NimbusClientManager.getNimbusClient(name);
        ClusterSummary clusterSummary = client.getClient().getClusterInfo();

        model.addAttribute("nimbus", UIUtils.getNimbusEntities(clusterSummary));
        model.addAttribute("topologies", UIUtils.getTopologyEntities(clusterSummary));
        model.addAttribute("supervisors", UIUtils.getSupervisorEntities(clusterSummary));

        model.addAttribute("zkServers", UIUtils.getZooKeeperEntities(name));

        List<MetricInfo> clusterMetrics = client.getClient().getMetrics(JStormMetrics.CLUSTER_METRIC_KEY,
                MetaType.TOPOLOGY.getT());
        UISummaryMetric clusterData = UIMetricUtils.getSummaryMetrics(clusterMetrics, AsmWindow.M1_WINDOW);
        model.addAttribute("clusterData", clusterData);
        model.addAttribute("clusterHead", UIMetricUtils.sortHead(clusterData, UISummaryMetric.HEAD));

        //update cluster cache
        ClusterEntity ce = UIUtils.getClusterEntity(clusterSummary, name);
        model.addAttribute("cluster", ce);
        UIUtils.clustersCache.put(name, ce);
    } catch (Exception e) {
        NimbusClientManager.removeClient(name);
        LOG.error(e.getMessage(), e);
        UIUtils.addErrorAttribute(model, e);
    }

    //set nimbus port and supervisor port , if necessary
    model.addAttribute("nimbusPort", UIUtils.getNimbusPort(name));
    model.addAttribute("supervisorPort", UIUtils.getSupervisorPort(name));
    model.addAttribute("clusterName", name);
    model.addAttribute("page", "cluster");
    UIUtils.addTitleAttribute(model, "Cluster Summary");
    LOG.info("cluster page show cost:{}ms", System.currentTimeMillis() - start);
    return "cluster";
}

From source file:com.davis.ddf.crs.data.SourceEndpointException.java

/**
 * Since we always want to return the JSON representation of an instance of {@link
 * JsonApiResponse}, then we don't want to use this method since it's designed to just return a
 * string message./*from w w w. j  a va2s.  c  om*/
 *
 * @param message the message
 * @param status the status
 */
@Deprecated
public SourceEndpointException(String message, Status status) {
    super(Response.status(status).entity(StringEscapeUtils.escapeHtml(message))
            .header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN).build());
}

From source file:mesquite.tol.lib.BaseHttpRequestMaker.java

public static boolean postToServer(String s, String URI, StringBuffer response) {
    HttpClient client = new HttpClient();
    PostMethod method = new PostMethod(URI);
    method.addParameter("OS", StringEscapeUtils
            .escapeHtml(System.getProperty("os.name") + "\t" + System.getProperty("os.version")));
    method.addParameter("JVM", StringEscapeUtils
            .escapeHtml(System.getProperty("java.version") + "\t" + System.getProperty("java.vendor")));
    NameValuePair post = new NameValuePair();
    post.setName("post");
    post.setValue(StringEscapeUtils.escapeHtml(s));
    method.addParameter(post);//w  w  w . j  a  v  a 2 s.  c  o m

    method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
            new DefaultHttpMethodRetryHandler(3, false));

    return executeMethod(client, method, response);
}

From source file:com.sonymobile.backlogtool.AttributeOption.java

public String getIcon() {
    return StringEscapeUtils.escapeHtml(icon);
}

From source file:com.googlecode.jtiger.modules.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);
    }//from   ww  w.j  av  a 2s.  c  o m
    return value;
}

From source file:com.redhat.rhn.domain.action.config.ConfigUploadActionFormatter.java

private String renderChannel(ConfigChannel channel) {
    HtmlTag a = new HtmlTag("a");
    a.setAttribute("href", "/rhn/configuration/ChannelOverview.do?ccid=" + channel.getId().toString());
    a.addBody(StringEscapeUtils.escapeHtml(channel.getDisplayName()));
    return a.render();
}

From source file:com.github.luuuis.myzone.preference.TimeZoneInfo.java

public String getIdHtml() {
    return StringEscapeUtils.escapeHtml(getId());
}

From source file:cn.hxh.springside.utils.EncodeUtils.java

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

From source file:hudson.plugins.ansicolor.AnsiColorNoteTest.java

@Test
public void testMultibyte() throws IOException {
    assertThatAnnotateIs("\u3053\u3093\u306b\u3061\u306f",
            "<b>" + StringEscapeUtils.escapeHtml("\u3053\u3093\u306b\u3061\u306f") + "</b>",
            "\u3053\u3093\u306b\u3061\u306f");
}