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


Java JSONObject.escape方法代码示例

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


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

示例1: prepareBugDescriptionForBugCreation

import net.minidev.json.JSONObject; //导入方法依赖的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

示例2: addCommentToIssue

import net.minidev.json.JSONObject; //导入方法依赖的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

示例3: matchText

import net.minidev.json.JSONObject; //导入方法依赖的package包/类
public Match matchText(String exp, MatchType matchType) {
    String quoted = exp == null ? "null" : "\"" + JSONObject.escape(exp) + "\"";
    return match(quoted, matchType);
}
 
开发者ID:intuit,项目名称:karate,代码行数:5,代码来源:Match.java


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