当前位置: 首页>>代码示例>>Java>>正文


Java StringEscapeUtils.escapeHtml4方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringEscapeUtils.escapeHtml4方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.escapeHtml4方法的具体用法?Java StringEscapeUtils.escapeHtml4怎么用?Java StringEscapeUtils.escapeHtml4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringEscapeUtils的用法示例。


在下文中一共展示了StringEscapeUtils.escapeHtml4方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newSuggestionItem

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private Component newSuggestionItem(String itemId, InputCompletion suggestion) {
	WebMarkupContainer item = new WebMarkupContainer(itemId);
	WebMarkupContainer link = new WebMarkupContainer("link");
	Range matchRange = suggestion.getMatchRange();
	String label = suggestion.getLabel();
	if (matchRange != null) {
		String prefix = StringEscapeUtils.escapeHtml4(label.substring(0, matchRange.getFrom()));
		String suffix = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getTo()));
		String matched = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getFrom(), matchRange.getTo()));
		link.add(new Label("label", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
	} else {
		link.add(new Label("label", label));
	}
	item.add(link);
	if (suggestion.getDescription() != null)
		item.add(new Label("description", suggestion.getDescription()));
	else
		item.add(new Label("description").setVisible(false));
	item.add(AttributeAppender.append("data-content", suggestion.complete(inputStatus).getContent()));
	item.add(AttributeAppender.append("data-caret", suggestion.getCaret()));
	item.setOutputMarkupId(true);
	return item;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:AssistPanel.java

示例2: apply

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public void apply(ApiRequest request, ApiResponse response, WebSocketSession session) {
    String msg = StringEscapeUtils.escapeHtml4(request.getMsg());
    if (StringUtils.isBlank(msg)) {
        return;
    }
    Map<String, Object> attributes = session.getAttributes();
    String id = session.getId();
    DrawPlayerInfo info = ((DrawPlayerInfo) attributes.get("info"));
    DrawGuessContext ctx = (DrawGuessContext) attributes.get("ctx");
    DrawGameStatus status = ctx.status();
    ArrayList<String> msgs = new ArrayList<>(2);
    if (status == DrawGameStatus.RUN) {
        if (StringUtils.equals(id, ctx.getCurrentUser())) {
            protectSecret(info, ctx, msg, msgs);
        } else {
            processGussPerson(info, ctx, msg, msgs);
        }
    } else {
        msgs.add("<b>" + info.getName() + "</b>: " + msg);
    }
    response.setCode(DrawCode.DRAW_MSG.getCode()).setData(msgs);
}
 
开发者ID:csdbianhua,项目名称:telemarket-skittle-alley,代码行数:24,代码来源:UserMsgHandler.java

示例3: doPost

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * doPost method to handle operations: like review, save hotel, check Expedia link.
 *
 * @param request
 * @param response
 * @throws IOException
 */
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
    List<String> types = getTypes();
    String type = StringEscapeUtils.escapeHtml4(request.getParameter("type"));
    String id = StringEscapeUtils.escapeHtml4(request.getParameter("id"));
    String username = getUsername(request);
    PrintWriter out = response.getWriter();

    if (username != null && types.contains(type)) {
        try {
            out.println(dbhandler.setLike(type, id, username));
        }
        catch (SQLException e) {
            System.out.println(e);
        }
    }
}
 
开发者ID:brianisadog,项目名称:hotelApp,代码行数:25,代码来源:LikeServlet.java

示例4: prepareBugDescriptionForBugCreation

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Prepares the description of bug body. By adding build url, a nice header, a note and
 * excaptes html tags, json tags.
 *
 * @param description
 * @return
 */
private String prepareBugDescriptionForBugCreation(String description)
{
    description = "*[Automation failed tests]*\n" +
            "||Testcase failing|| Parameters||\n" +
            description + "\n" +
            System.getProperty(AUTO_CREATE_ADDITIONAL_DETAILS,
                    configuration.getProperty(AUTO_CREATE_ADDITIONAL_DETAILS, "")) + "\n" +
            "Build url: " + buildUrl;
    description = description + "\n\n\n" + "Note: This bug is created automatically by DolphinNG." +
            " Please do not edit summary line of the bug.";
    description = StringEscapeUtils.escapeHtml3(description);
    description = StringEscapeUtils.escapeHtml4(description);
    description = JSONObject.escape(description);
    return description;
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:23,代码来源:JIRAClient.java

示例5: doPost

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * doPost method to clear particular field of MyPage.
 *
 * @param request
 * @param response
 * @throws IOException
 */
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
    Map<String, List<String>> types = getTypesMap();
    String type = StringEscapeUtils.escapeHtml4(request.getParameter("type"));
    String username = getUsername(request);
    PrintWriter out = response.getWriter();

    if (username != null && types.containsKey(type)) {
        try {
            out.println(dbhandler.clearMyData(types.get(type), username));
        }
        catch (SQLException e) {
            System.out.println(e);
        }
    }
}
 
开发者ID:brianisadog,项目名称:hotelApp,代码行数:24,代码来源:ClearServlet.java

示例6: getAllHangManOptionByContainer

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * GET  /hangManExercises -> get all the hangManExercises.
 */
@RequestMapping(value = "/hangManExerciseOptions/container/{id}",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<Object> getAllHangManOptionByContainer(@PathVariable Long id) {
    log.debug("REST request to get all HangManExercises");
    List<Object> output;
    output= hangManExerciseOptionService.getFixedOptionsRandomOrder(id, 10);
    for (Object o: output)
    	((Object[]) o)[1] = StringEscapeUtils.escapeHtml4(((Object[]) o)[1].toString());
    return output;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:16,代码来源:HangManExerciseOptionResource.java

示例7: convert

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public HTMLNotebookOutput convert(final Object object) {
    final String escaped = StringEscapeUtils.escapeHtml4(object.toString());
    // Add in zero width space character (&#8203;) before @, ., $, _, and #
    final String wordBreaks = escaped.replaceAll("([@.$_#])", "&#8203;$1");
    return new HTMLNotebookOutput(wordBreaks);
}
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:8,代码来源:ObjectToHTMLNotebookConverter.java

示例8: getIntroForHtml

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * 获取HTML格式的小说简介信息
 * 
 * @return HTML格式的小说简介信息
 */
public String getIntroForHtml() {
    if (getIntro() != null) {
        // 替换换行和空格
        String html = StringEscapeUtils.escapeHtml4(getIntro());
        return html.replaceAll("\r\n", "<br/>").replaceAll("\n", "<br/>").replaceAll("\\s", "&nbsp;");
    }
    return null;
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:14,代码来源:TArticle.java

示例9: name

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public static String name(IUser u, IGuild g, boolean showRealName) {
	String s = StringEscapeUtils.escapeHtml4(u.getName()+"#"+u.getDiscriminator());
	if(!u.getName().equals(u.getDisplayName(g)) && showRealName)s+=" ("+u.getDisplayName(g)+") ";
	if(u.isBot())s+=" <span class='usermod_bot'>"+Main.lang.getLangage("tools.usermod.bot").toUpperCase()+"</span>";
	try{if(Main.appid==u.getLongID())s+=" <span class='usermod_me'>"+Main.lang.getLangage("tools.usermod.me").toUpperCase()+"</span>";}catch(Exception e) {}
	return s;
}
 
开发者ID:ate47,项目名称:ATEBot,代码行数:8,代码来源:UserModHandler.java

示例10: doPost

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * doPost method to display user's data in MyPage, five rows of data per request.
 *
 * @param request
 * @param response
 * @throws IOException
 */
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
    Map<String, List<String>> types = getTypesMap();
    String type = StringEscapeUtils.escapeHtml4(request.getParameter("type"));
    int finish = Integer.parseInt(request.getParameter("finish"));
    String username = getUsername(request);

    if (username != null && types.containsKey(type) && finish == 0) {
        try (ResultSet result = dbhandler.getMyData(types.get(type), username)) {
            StringBuilder sb = new StringBuilder();
            PrintWriter out = response.getWriter();
            int data = Integer.parseInt(request.getParameter("data"));
            int count = 0, display = 0;

            while (result.next()) {
                count++;
                if (count > data && display < 5) {
                    display++;
                    sb.append("<tr><td name=\"" + type + "Data\" onclick=\"" + getFunction(type, result) + "\">");
                    sb.append(result.getString(types.get(type).get(3)));
                    sb.append("</td></tr>");
                }
            }

            if (count == 0) {
                sb.append("<tr><td name=\"" + type + "Finish\">No result.</td></tr>");
            }
            else if (count == data + display) {
                sb.append("<tr hidden><td name=\"" + type + "Finish\"></td></tr>");
            }

            out.println(sb.toString());
        }
        catch (SQLException e) {
            System.out.println(e);
        }
    }
}
 
开发者ID:brianisadog,项目名称:hotelApp,代码行数:46,代码来源:MyPageServlet.java

示例11: computeTemplate

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public String computeTemplate() {
	if (isEnabled()) {
		return StringEscapeUtils.escapeHtml4(getTextValue()) + System.getProperty("line.separator");
	}
	else {
		return "";
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:10,代码来源:UIText.java

示例12: addCommentToIssue

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Adds a comment to the jira ticket
 *
 * @param jiraTicket - jira ticket id
 * @param comment    - comment to add
 * @return
 * @throws MalformedURLException
 */
public boolean addCommentToIssue(String jiraTicket, String comment) throws MalformedURLException
{
    URL request = new URL("https://" + configuration.getProperty(DEFECT_MGMT_HOST) +
            configuration.getProperty(BUG_API) + "/" + jiraTicket + "/comment");
    comment = comment + "\n\n\n" + "Test Run URL: " + buildUrl;
    comment = comment + "\n" + "Note: This comment is created automatically by DolphinNG.";
    comment = StringEscapeUtils.escapeHtml3(comment);
    comment = StringEscapeUtils.escapeHtml4(comment);
    comment = JSONObject.escape(comment);
    String payload =
            "{" +
                    "\"body\":" + "\"" + comment + "\"" +
                    "}";
    RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
    RequestSpecification given = RestAssured.given();
    given = given.header(authenticationHeader);
    Response response = given
            .contentType(CONTENT_TYPE_APPLICATION_JSON)
            .accept(CONTENT_TYPE_APPLICATION_JSON)
            .when().body(payload).post(request).then()
            .extract().response();
    LOG.info("JIRA ticket creation result--->  StatusCode=" +
            response.getStatusCode() + " status=" + response.getStatusLine() +
            " payload=" + payload +
            " Response=" + response.getBody().prettyPrint());
    return response.getStatusCode() == 201;
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:36,代码来源:JIRAClient.java

示例13: escapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Html 转码.
 */
public static String escapeHtml(String html) {
    return StringEscapeUtils.escapeHtml4(html);
}
 
开发者ID:NeilRen,项目名称:NEILREN4J,代码行数:7,代码来源:Encodes.java

示例14: escape

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private String escape(String text) {
	return StringEscapeUtils.escapeHtml4(text);
}
 
开发者ID:codeurjc,项目名称:slides-converter,代码行数:4,代码来源:PowerPointToHTML.java

示例15: escapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public static String escapeHtml(String text) {
    return StringEscapeUtils.escapeHtml4(text);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:4,代码来源:StringUtils.java


注:本文中的org.apache.commons.lang3.StringEscapeUtils.escapeHtml4方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。