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


Java HtmlEscape类代码示例

本文整理汇总了Java中org.unbescape.html.HtmlEscape的典型用法代码示例。如果您正苦于以下问题:Java HtmlEscape类的具体用法?Java HtmlEscape怎么用?Java HtmlEscape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HtmlEscape类属于org.unbescape.html包,在下文中一共展示了HtmlEscape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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