本文整理汇总了Java中org.unbescape.html.HtmlEscape类的典型用法代码示例。如果您正苦于以下问题:Java HtmlEscape类的具体用法?Java HtmlEscape怎么用?Java HtmlEscape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlEscape类属于org.unbescape.html包,在下文中一共展示了HtmlEscape类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: respond
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
String feedbackHtml;
TestResult result = test();
if (result.isSuccessful()) {
feedbackHtml = String.format(
"<div class='test-feedback alert alert-success'>%s</div>",
HtmlEscape.escapeHtml5(result.getMessage()));
} else {
feedbackHtml = String.format(
"<div class='test-feedback alert alert-danger'>%s</div>",
HtmlEscape.escapeHtml5(result.getMessage()));
}
feedbackHtml = StringUtils.replace(feedbackHtml, "\n", "<br>");
target.appendJavaScript(String.format("var $button = $('#%s');"
+ "$button.removeAttr('disabled');"
+ "$button.val($button[0].prevValue);"
+ "$button.html($button[0].prevHtml);"
+ "$button.closest('form').append('%s');"
+ "$button.removeClass('ajax-indicator');",
getComponent().getMarkupId(), JavaScriptEscape.escapeJavaScript(feedbackHtml)));
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:23,代码来源:TestFormBehavior.java
示例2: CommitMessageLabel
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
public CommitMessageLabel(String id, IModel<Project> projectModel, IModel<String> messageModel) {
super(id, new LoadableDetachableModel<String>() {
@Override
protected String load() {
String message = HtmlEscape.escapeHtml5(messageModel.getObject());
for (CommitMessageTransformer transformer: GitPlex.getExtensions(CommitMessageTransformer.class)) {
message = transformer.transform(projectModel.getObject(), message);
}
return message;
}
@Override
protected void onDetach() {
projectModel.detach();
messageModel.detach();
super.onDetach();
}
});
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:CommitMessageLabel.java
示例3: doProcess
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
protected void doProcess(ITemplateContext iTemplateContext,
IProcessableElementTag iProcessableElementTag,
AttributeName attributeName,
String attributeValue,
IElementTagStructureHandler iElementTagStructureHandler) {
final String type = iProcessableElementTag.getAttributeValue("type");
final String property = iProcessableElementTag.getAttributeValue("property");
final String text = ShiroFacade.getPrincipalText(type, property);
final String elementCompleteName = iProcessableElementTag.getElementCompleteName();
final IModelFactory modelFactory = iTemplateContext.getModelFactory();
final IModel model = modelFactory.createModel();
model.add(modelFactory.createOpenElementTag(elementCompleteName));
model.add(modelFactory.createText(HtmlEscape.escapeHtml5(text)));
model.add(modelFactory.createCloseElementTag(elementCompleteName));
iElementTagStructureHandler.replaceWith(model, false);
}
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:23,代码来源:PrincipalAttrProcessor.java
示例4: appendBlame
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private void appendBlame(StringBuilder builder, int oldLineNo, int newLineNo) {
BlameCommit commit;
if (newLineNo != -1)
commit = Preconditions.checkNotNull(blameInfo.newBlame.get(newLineNo));
else
commit = Preconditions.checkNotNull(blameInfo.oldBlame.get(oldLineNo));
if (diffMode == DiffViewMode.UNIFIED && !commit.getHash().equals(blameInfo.lastCommitHash)
|| diffMode == DiffViewMode.SPLIT && newLineNo != -1 && !commit.getHash().equals(blameInfo.lastNewCommitHash)
|| diffMode == DiffViewMode.SPLIT && oldLineNo != -1 && !commit.getHash().equals(blameInfo.lastOldCommitHash)) {
CommitDetailPage.State state = new CommitDetailPage.State();
state.revision = commit.getHash();
state.whitespaceOption = change.getWhitespaceOption();
PageParameters params = CommitDetailPage.paramsOf(projectModel.getObject(), state);
String url = urlFor(CommitDetailPage.class, params).toString();
if (diffMode == DiffViewMode.UNIFIED) {
builder.append(String.format("<td class='blame noselect'><a class='hash' href='%s' data-hash='%s'>%s</a><span class='date'>%s</span><span class='author'>%s</span></td>",
url, commit.getHash(), GitUtils.abbreviateSHA(commit.getHash()),
DateUtils.formatDate(commit.getCommitter().getWhen()),
HtmlEscape.escapeHtml5(commit.getAuthor().getName())));
} else {
builder.append(String.format("<td class='abbr blame noselect'><a class='hash' href='%s' data-hash='%s'>%s</a></td>",
url, commit.getHash(), GitUtils.abbreviateSHA(commit.getHash())));
}
} else {
if (diffMode == DiffViewMode.UNIFIED) {
builder.append("<td class='blame noselect'><div class='same-as-above'>...</div></td>");
} else {
builder.append("<td class='abbr blame noselect'><div class='same-as-above'>...</div></td>");
}
}
blameInfo.lastCommitHash = commit.getHash();
if (newLineNo != -1)
blameInfo.lastNewCommitHash = commit.getHash();
if (oldLineNo != -1)
blameInfo.lastOldCommitHash = commit.getHash();
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:37,代码来源:TextDiffPanel.java
示例5: getJsonOfBlameInfos
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private String getJsonOfBlameInfos(boolean blamed) {
String jsonOfBlameInfos;
if (blamed) {
List<BlameInfo> blameInfos = new ArrayList<>();
String commitHash = context.getCommit().name();
BlameCommand cmd = new BlameCommand(context.getProject().getGitDir());
cmd.commitHash(commitHash).file(context.getBlobIdent().path);
for (Blame blame: cmd.call().values()) {
BlameInfo blameInfo = new BlameInfo();
blameInfo.commitDate = DateUtils.formatDate(blame.getCommit().getCommitter().getWhen());
blameInfo.authorName = HtmlEscape.escapeHtml5(blame.getCommit().getAuthor().getName());
blameInfo.hash = blame.getCommit().getHash();
blameInfo.abbreviatedHash = GitUtils.abbreviateSHA(blame.getCommit().getHash(), 7);
CommitDetailPage.State state = new CommitDetailPage.State();
state.revision = blame.getCommit().getHash();
state.pathFilter = context.getBlobIdent().path;
PageParameters params = CommitDetailPage.paramsOf(context.getProject(), state);
blameInfo.url = RequestCycle.get().urlFor(CommitDetailPage.class, params).toString();
blameInfo.ranges = blame.getRanges();
blameInfos.add(blameInfo);
}
try {
jsonOfBlameInfos = GitPlex.getInstance(ObjectMapper.class).writeValueAsString(blameInfos);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
} else {
jsonOfBlameInfos = "undefined";
}
return jsonOfBlameInfos;
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:34,代码来源:SourceViewPanel.java
示例6: getReplyString
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
static String getReplyString(String string) {
if (!StringUtils.hasText(string)) {
return "";
}
return HtmlEscape.escapeHtml4Xml(new BufferedReader(new StringReader(string)).lines()
.filter(line -> !line.startsWith("> "))
.collect(Collectors.joining("\n> ", "> ", "\n")));
}
开发者ID:zjnu-acm,项目名称:judge,代码行数:9,代码来源:JudgeUtils.java
示例7: generateNode
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
protected void generateNode(ContentNode contentNode, HtmlCanvas html) throws IOException {
if (contentNode.getType().equals(ContentNodeType.TEXT)) {
html/* .div(class_(contentNode.getCss())) */.write(HtmlEscape.unescapeHtml(contentNode.getContent()),
false)/* ._div() */;
}
if (contentNode.getType().equals(ContentNodeType.WIDGET) && contentNode.getWidget() != null
&& !contentNode.getWidget().isEmpty()) {
generateWidgetNode(contentNode, html);
}
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:14,代码来源:DefaultContentService.java
示例8: getParagraph
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private static String getParagraph(String section) {
Matcher matcher = PARAGRAPH.matcher(section);
if(!matcher.find())
return null;
return HtmlEscape.unescapeHtml(matcher.group(1)).replaceAll("(?s)[\\r\\n\\s]+", " ");
}
开发者ID:Android-leak,项目名称:csploit,代码行数:8,代码来源:Rapid7.java
示例9: getAuthors
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private static Collection<Author> getAuthors(String section) {
Matcher matcher = ITEM.matcher(section);
LinkedList<Author> list = new LinkedList<Author>();
while(matcher.find()) {
list.add(Author.fromString(HtmlEscape.unescapeHtml(matcher.group(1))));
}
return list;
}
开发者ID:Android-leak,项目名称:csploit,代码行数:11,代码来源:Rapid7.java
示例10: doInBackground
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@SafeVarargs
@Override
protected final List<Pair<Integer, String>> doInBackground(Pair<Integer, String>... params) {
if (params == null || params.length == 0) {
return null;
}
List<Pair<Integer, String>> htmls = new ArrayList<>();
for(Pair<Integer, String> html : params) {
htmls.add(Pair.create(html.first, HtmlEscape.unescapeHtml(html.second)));
}
return htmls;
}
开发者ID:filipebezerra,项目名称:VerseOfTheDay,代码行数:16,代码来源:UnscapeHtmlTask.java
示例11: latexPreProcessing
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
/**
* Pre processing mathematical latex expressions with
* several methods.
*
* @param latex raw latex input
* @return pre processed latex string
*/
public static String latexPreProcessing(String latex ){
LOG.debug(" Pre-Processing for: " + latex);
if ( latex.contains("subarray") ){
latex = latex.replaceAll("subarray", "array");
LOG.trace(" Eval replacement of subarray: " + latex);
}
latex = latex.replaceAll( POM_BUG_AVOIDANCE_UNDERSCORE, "_{$1}" );
LOG.trace("Surround underscore: " + latex);
latex = latex.replaceAll( SINGLE_AND, TMP_SINGLE_AND );
latex = HtmlEscape.unescapeHtml(latex);
latex = latex.replaceAll( TMP_SINGLE_AND, " & " );
LOG.trace("HTML Unescaped: " + latex);
latex = latex.replaceAll( LATEX_COMMENTED_LINEBREAK, "" );
LOG.trace("Commented linebreaks: " + latex);
latex = latex.replaceAll( ELEMINATE_ENDINGS, "");
latex = latex.replaceAll( ELEMINATE_STARTS, "" );
latex = latex.replaceAll( ELEMINATE_SIMPLE_STARTS, "" );
latex = latex.replaceAll( ELEMINATE_SIMPLE_ENDS, "" );
LOG.trace("Replace bad end/start:" + latex);
LOG.debug("Finalize Pre-Processing for POM-Tagger: " + latex);
return latex;
}
开发者ID:ag-gipp,项目名称:mathosphere,代码行数:36,代码来源:Utility.java
示例12: safeUnescape
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
public static String safeUnescape( String escaped ){
escaped = escaped.replaceAll( SPECIAL_UNESCPAE_OPEN, PLACEHOLDER_OPEN );
escaped = escaped.replaceAll( SPECIAL_UNESCAPE_CLOSE, PLACEHOLDER_CLOSED );
escaped = escaped.replaceAll( SINGLE_AND, TMP_SINGLE_AND );
String unescaped = HtmlEscape.unescapeHtml(escaped);
unescaped = unescaped.replaceAll( TMP_SINGLE_AND, " & " );
unescaped = unescaped.replaceAll( PLACEHOLDER_OPEN, SPECIAL_UNESCPAE_OPEN );
unescaped = unescaped.replaceAll( PLACEHOLDER_CLOSED, SPECIAL_UNESCAPE_CLOSE );
return unescaped;
}
开发者ID:ag-gipp,项目名称:mathosphere,代码行数:11,代码来源:Utility.java
示例13: configure
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
env.xss("html", it -> HtmlEscape.escapeHtml(it, htmltype, htmllevel))
.xss("js", it -> JavaScriptEscape.escapeJavaScript(it, jstype, jslevel))
.xss("json", it -> JsonEscape.escapeJson(it, jsontype, jsonlevel))
.xss("css", it -> CssEscape.escapeCssString(it, csstype, csslevel))
.xss("uri", UriEscape::escapeUriPath)
.xss("queryParam", UriEscape::escapeUriQueryParam)
.xss("uriFragmentId", UriEscape::escapeUriFragmentId);
}
开发者ID:jooby-project,项目名称:jooby,代码行数:11,代码来源:XSS.java
示例14: newItem
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private Component newItem(String itemId, String itemValue) {
String ref;
if (itemValue.startsWith(COMMIT_FLAG))
ref = itemValue.substring(COMMIT_FLAG.length());
else if (itemValue.startsWith(ADD_FLAG))
ref = itemValue.substring(ADD_FLAG.length());
else
ref = itemValue;
AjaxLink<Void> link = new ViewStateAwareAjaxLink<Void>("link") {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new ConfirmLeaveListener());
}
@Override
public void onClick(AjaxRequestTarget target) {
if (itemValue.startsWith(ADD_FLAG)) {
onCreateRef(target, ref);
} else {
selectRevision(target, ref);
}
}
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
if (!itemValue.startsWith(ADD_FLAG)) {
String url = getRevisionUrl(ref);
if (url != null)
tag.put("href", url);
}
}
};
if (itemValue.startsWith(COMMIT_FLAG)) {
link.add(new Label("label", ref));
link.add(AttributeAppender.append("class", "icon commit"));
} else if (itemValue.startsWith(ADD_FLAG)) {
String label;
if (branchesActive)
label = "<div class='name'>Create branch <b>" + HtmlEscape.escapeHtml5(ref) + "</b></div>";
else
label = "<div class='name'>Create tag <b>" + HtmlEscape.escapeHtml5(ref) + "</b></div>";
label += "<div class='revision'>from " + HtmlEscape.escapeHtml5(revision) + "</div>";
link.add(new Label("label", label).setEscapeModelStrings(false));
link.add(AttributeAppender.append("class", "icon add"));
} else if (ref.equals(revision)) {
link.add(new Label("label", ref));
link.add(AttributeAppender.append("class", "icon current"));
} else {
link.add(new Label("label", ref));
}
WebMarkupContainer item = new WebMarkupContainer(itemId);
item.setOutputMarkupId(true);
item.add(AttributeAppender.append("data-value", HtmlEscape.escapeHtml5(itemValue)));
item.add(link);
return item;
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:64,代码来源:RevisionSelector.java
示例15: getBody
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
public IModel<?> getBody() {
return Model.of(String.format("<i class='fa fa-code-fork'></i> <span>%s</span> <i class='fa fa-caret-down'></i>",
HtmlEscape.escapeHtml5(branch)));
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:BranchPicker.java
示例16: toJson
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
public void toJson(String choice, JSONWriter writer) throws JSONException {
String escapedName = HtmlEscape.escapeHtml5(choice);
writer.key("id").value(escapedName).key("name").value(escapedName);
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:VerificationChoiceProvider.java
示例17: toString
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@Override
public String toString() {
return pureText && StringUtils.hasText(info) ? HtmlEscape.escapeHtml4Xml(info) : info;
}
开发者ID:zjnu-acm,项目名称:judge,代码行数:5,代码来源:SystemInfoForm.java
示例18: bbs
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
@GetMapping(value = "/bbs", produces = TEXT_HTML_VALUE)
public String bbs(HttpServletRequest request,
@RequestParam(value = "problem_id", required = false) Long problemId,
@RequestParam(value = "size", defaultValue = "50") final int threadLimit,
@RequestParam(value = "top", defaultValue = "99999999") final long top,
Model model) {
int limit = Math.max(Math.min(threadLimit, 500), 0);
final long mint = messageMapper.mint(top, problemId, limit, 0);
final List<Message> messages = messageMapper.findAllByThreadIdBetween(mint, top, problemId, null);
long currentDepth = 0;
long lastThreadId = 0;
model.addAttribute("title", "Messages");
StringBuilder sb = new StringBuilder("<table width=100% class=\"table-default table-back\">"
+ "<tr><td><ul>");
long maxThreadId = messages.stream().mapToLong(Message::getThread).max().orElse(0);
final long maxt = messageMapper.maxt(maxThreadId, problemId, limit, 999999999999L);
for (Message message : messages) {
long depth = message.getDepth();
String title = message.getTitle();
String userId = message.getUser();
long messageId = message.getId();
Timestamp timestamp = Timestamp.from(message.getInDate());
long threadId = message.getThread();
Long problem = message.getProblem();
for (; currentDepth < depth; currentDepth++) {
sb.append("<ul>");
}
for (; currentDepth > depth; currentDepth--) {
sb.append("</ul>");
}
if (lastThreadId != 0 && threadId != lastThreadId && depth == 0) {
sb.append("<hr/>");
}
lastThreadId = threadId;
sb.append("<li><a href=\"showmessage?message_id=").append(messageId)
.append("\"><font color=\"blue\">")
.append(HtmlEscape.escapeHtml4Xml(title))
.append("</font></a> <b><a href=\"userstatus?user_id=")
.append(userId).append("\"><font color=\"black\">")
.append(userId).append("</font></a></b> ")
.append(timestamp);
if (problem != null && problem != 0L && depth == 0) {
sb.append(" <b><a href=\"showproblem?problem_id=").append(problem)
.append("\"><font color=\"black\">Problem ").append(problem)
.append("</font></a></b>");
}
}
for (; currentDepth > 0; currentDepth--) {
sb.append("</ul>");
}
sb.append("</ul></td></tr></table><center>");
URLBuilder query = URLBuilder.fromRequest(request)
.replacePath("bbs")
.replaceQueryParam("top");
sb.append("<hr/>[<a href=\"").append(query).append("\">Top</a>]");
query.replaceQueryParam("top", Long.toString(maxt));
sb.append(" [<a href=\"").append(query).append("\">Previous</a>]");
query.replaceQueryParam("top", Long.toString(mint));
sb.append(" [<a href=\"").append(query)
.append("\">Next</a>]<br/></center><form action=\"postpage\">");
if (problemId != null) {
sb.append("<input type=\"hidden\" name=\"problem_id\" value=\"").append(problemId).append("\">");
}
sb.append("<button type=\"submit\">Post new message</button></form>");
model.addAttribute("content", sb.toString());
return "legacy";
}
开发者ID:zjnu-acm,项目名称:judge,代码行数:72,代码来源:BBSController.java
示例19: saveToFile
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private void saveToFile(
final URI location,
final String subject,
final String body) {
try {
// Create dir if it doesn't exist
Path path = Paths.get(location);
if (!path.toFile().exists()) {
io.spikex.core.util.Files.createDirectories(
config().getString(CONF_KEY_USER),
OWNER_FULL_GROUP_EXEC,
path);
}
//
// Unescape body
//
String text = body;
if (m_config.getFileHtmlUnescape()) {
text = HtmlEscape.unescapeHtml(body);
}
//
DateTime now = DateTime.now();
StringBuilder filename = new StringBuilder();
String datePart = DTF_FILE_DATE.print(now);
filename.append(datePart); // YYYYMMDD
filename.append("-");
filename.append(DTF_FILE_TM.print(now)); // HHmmssSSS
filename.append("-");
filename.append(XXHash32.hashAsHex(text, FILENAME_SALT));
filename.append(".ntf");
// Create subdir (if it doesn't exist)
Path datePath = path.resolve(datePart);
if (!datePath.toFile().exists()) {
io.spikex.core.util.Files.createDirectories(
config().getString(CONF_KEY_USER),
OWNER_FULL_GROUP_EXEC,
datePath);
}
Files.write(datePath.resolve(filename.toString()), text.getBytes());
m_logger.debug("Saved notification to: {}", path);
} catch (IOException e) {
m_logger.error("Failed to save \"{}\"notification", subject, e);
}
}
开发者ID:clidev,项目名称:spike.x,代码行数:48,代码来源:Dispatcher.java
示例20: buildBaseUrl
import org.unbescape.html.HtmlEscape; //导入依赖的package包/类
private static String buildBaseUrl(final ITemplateContext context, Collection<String> excludeParams) {
// URL defined with pagination-url tag
final String url = (String) context.getVariable(Keys.PAGINATION_URL_KEY);
if (url == null && context instanceof IWebContext) {
// Creates url from actual request URI and parameters
final StringBuilder builder = new StringBuilder();
final IWebContext webContext = (IWebContext) context;
final HttpServletRequest request = webContext.getRequest();
// URL base path from request
builder.append(request.getRequestURI());
Map<String, String[]> params = request.getParameterMap();
Set<Entry<String, String[]>> entries = params.entrySet();
boolean firstParam = true;
for (Entry<String, String[]> param : entries) {
// Append params not excluded to basePath
String name = param.getKey();
if (!excludeParams.contains(name)) {
if (firstParam) {
builder.append(Q_MARK);
firstParam = false;
} else {
builder.append(AND);
}
// Iterate over all values to create multiple values per
// parameter
String[] values = param.getValue();
Collection<String> paramValues = Arrays.asList(values);
Iterator<String> it = paramValues.iterator();
while (it.hasNext()) {
String value = it.next();
builder.append(name).append(EQ).append(value);
if (it.hasNext()) {
builder.append(AND);
}
}
}
}
// Escape to HTML content
return HtmlEscape.escapeHtml4Xml(builder.toString());
}
return url == null ? EMPTY : url;
}
开发者ID:jpenren,项目名称:thymeleaf-spring-data-dialect,代码行数:49,代码来源:PageUtils.java
注:本文中的org.unbescape.html.HtmlEscape类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论