本文整理匯總了Java中org.apache.commons.lang3.StringEscapeUtils.escapeHtml3方法的典型用法代碼示例。如果您正苦於以下問題:Java StringEscapeUtils.escapeHtml3方法的具體用法?Java StringEscapeUtils.escapeHtml3怎麽用?Java StringEscapeUtils.escapeHtml3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.StringEscapeUtils
的用法示例。
在下文中一共展示了StringEscapeUtils.escapeHtml3方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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;
}