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

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

Introduction

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

Prototype

public static final String unescapeHtml4(final String input) 

Source Link

Document

Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.

Usage

From source file:pah9qdmoviereviews.NYTMovieReview.java

public void setHeadline(String headline) {
    this.headline = StringEscapeUtils.unescapeHtml4(headline);
}

From source file:pah9qdmoviereviews.NYTMovieReview.java

public void setSummary(String summary) {
    this.summary = StringEscapeUtils.unescapeHtml4(summary);
}

From source file:ru.org.linux.comment.PreparedComment.java

public PreparedComment(Comment comment, ApiUserRef author, String processedMessage, @Nullable ReplyInfo reply,
        boolean deletable, boolean editable, String remark, @Nullable Userpic userpic,
        @Nullable ApiDeleteInfo deleteInfo, @Nullable EditSummary editSummary, @Nullable String postIP,
        @Nullable String userAgent) {
    this.deleteInfo = deleteInfo;
    this.editSummary = editSummary;
    this.postIP = postIP;
    this.userAgent = userAgent;
    this.id = comment.getId();
    this.author = author;
    this.processedMessage = processedMessage;
    this.reply = reply;
    this.deletable = deletable;
    this.editable = editable;
    this.remark = remark;
    this.userpic = userpic;

    String encodedTitle = Strings.emptyToNull(comment.getTitle().trim());

    if (encodedTitle != null) {
        title = StringEscapeUtils.unescapeHtml4(encodedTitle);
    } else {/*from w  ww .  j a  v  a 2  s.  com*/
        title = null;
    }

    deleted = comment.isDeleted();
    postdate = comment.getPostdate();
}

From source file:secureemailclient.applet.MessageListPanel.java

public void loadMessageList(List<Message> messageList) {
    DefaultTableModel model = (DefaultTableModel) jTableMessages.getModel();
    model.setRowCount(0);//ww  w.ja  v a 2  s  . c  o m
    for (Message message : messageList) {
        MessagePart payload = message.getPayload();

        String date = null, from = null, to = null, subject = null;

        List<MessagePartHeader> headers = payload.getHeaders();
        for (MessagePartHeader header : headers) {
            switch (header.getName()) {
            case "To":
                to = header.getValue();
                break;
            case "From":
                from = header.getValue();
                break;
            case "Subject":
                subject = header.getValue();
                break;
            case "Date":
                date = header.getValue();
                break;
            }
        }

        model.addRow(
                new Object[] { to, "<html>" + StringEscapeUtils.unescapeHtml4(message.getSnippet()) + "</html>",
                        date, message.getId() });
    }
}

From source file:sg.yeefan.searchenginewrapper.clients.DuckDuckGoClient.java

private String[] processSnippet(String snippet) {
    String line = StringEscapeUtils.unescapeHtml4(snippet);
    line = line.replaceAll("'''", "");
    line = line.trim().replaceAll("\\s+", " ");
    return new String[] { line };
}

From source file:sg.yeefan.searchenginewrapper.clients.GoogleCustomClient.java

/**
 * Processes the snippet of the search result.
 *///from   w w  w.  j av  a 2  s . c  om
private String[] processSnippet(String snippet) {
    String[] lines = snippet.split("<b>\\.+</b>", 0);
    List<String> list = new ArrayList<String>(lines.length);
    for (String line : lines) {
        line = line.replaceAll("<b>", "").replaceAll("</b>", "").replaceAll("<br>", "");
        line = StringEscapeUtils.unescapeHtml4(line);
        line = line.trim().replaceAll("\\s+", " ");
        if (line.length() > 0)
            list.add(line);
    }
    String[] result = new String[list.size()];
    list.toArray(result);
    return result;
}

From source file:sg.yeefan.searchenginewrapper.clients.TwitterClient.java

private String[] processSnippet(String snippet) {
    String[] lines = StringEscapeUtils.unescapeHtml4(snippet).split("\\n+");
    List<String> list = new ArrayList<String>(lines.length);
    for (String line : lines) {
        line = line.trim().replaceAll("\\s+", " ");
        if (line.length() > 0)
            list.add(line);/*from ww  w . j av  a2  s.  c o  m*/
    }
    String[] result = new String[list.size()];
    list.toArray(result);
    return result;
}

From source file:sg.yeefan.searchenginewrapper.clients.WikipediaClient.java

/**
 * Processes the snippet of the search result.
 *///w w  w  .  j ava 2 s  . c om
private String[] processSnippet(String snippet) {
    String[] lines = snippet.split("<b>\\.+</b>", 0);
    List<String> list = new ArrayList<String>(lines.length);
    for (String line : lines) {
        line = line.replaceAll("\\<.*?>", "");
        line = StringEscapeUtils.unescapeHtml4(line);
        line = line.trim().replaceAll("\\s+", " ");
        if (line.length() > 0)
            list.add(line);
    }
    String[] result = new String[list.size()];
    list.toArray(result);
    return result;
}

From source file:silvertrout.commons.EscapeUtils.java

/**
 * Apply unescapeHtml, stripHtml, and normalizeSpaces on a given String, and
 * return the result.//from   w w  w  .java 2  s  .c  om
 *
 * @param data
 *            the String to apply the functions on
 * @return the result after all functions has been applied
 * @see EscapeUtils.unescapeHtml
 * @see EscapeUtils.stripHtml
 * @see EscapeUtils.normalizeSpaces
 */
public static String unescapeAndStripHtml(String data) {
    data = StringEscapeUtils.unescapeHtml4(data);
    data = EscapeUtils.stripHtml(data);
    data = EscapeUtils.normalizeSpaces(data);
    return data;
}

From source file:silvertrout.plugins.feedeater.RSSFeed.java

private String cleanData(String data) {
    data = StringEscapeUtils.unescapeHtml4(data);
    data = EscapeUtils.normalizeSpaces(data);
    return data;
}