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]+", " "); }
public static String html2utf8(String s) { String unescape = HtmlEscape.unescapeHtml(s); unescape = A_END_TAG.matcher(unescape).replaceAll(""); unescape = unescape.trim().replaceAll(" +", " "); return unescape; }
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; }
@Override public void onContentFetched(byte[] content) { String body = new String(content); Matcher matcher = RESULT.matcher(body); while(matcher.find()) { Exploit exploit = new Exploit(Integer.parseInt(matcher.group(2)), HtmlEscape.unescapeHtml(matcher.group(3))); exploit.setPort(port); try { job.add(new String(matcher.group(1).toCharArray()), new ExploitReceiver(job, exploit, receiver)); } catch (MalformedURLException e) { Logger.error(String.format("Bad URL: %s", matcher.group(1))); } catch (IllegalStateException e) { Logger.warning(e.getMessage()); } receiver.onItemFound(exploit); } synchronized (this) { if (!analyzePagination) return; analyzePagination = false; } parsePages(body); }
return HtmlEscape.unescapeHtml(input); case XML: return XmlEscape.unescapeXml(input);
/** * <p> * Returns the textual content of this node, as a String. * </p> * * @return the textual content of this node. */ public String getContent() { if (this.contentIsEscaped) { return HtmlEscape.unescapeHtml(this.content); } return this.content; }
/** * <p> * Returns the value of the attribute. * </p> * * @return the value of the attribute. */ public String getValue() { if (this.valueIsEscaped) { return HtmlEscape.unescapeHtml(this.value); } return this.value; }
@Override public Collection<String> toChoices(Collection<String> ids) { Collection<String> choices = new ArrayList<>(); for (String id: ids) choices.add(HtmlEscape.unescapeHtml(id)); return choices; }
final String match = HtmlEscape.unescapeHtml(matcher.group(1));
@Override public void handle(SkypeImpl skype, JsonObject resource) throws ConnectionException, ChatNotFoundException, IOException { String content = resource.get("content").asString(); ChatImpl chat = getChat(resource, skype); UserImpl initiator = getInitiator(resource, chat); Matcher timeMatcher = EVENTTIME_PATTERN.matcher(content); Matcher valueMatcher = VALUE_PATTERN.matcher(content); if (timeMatcher.find() && valueMatcher.find()) { long time = Long.parseLong(timeMatcher.group(1)); String topic = valueMatcher.groupCount() > 0 ? HtmlEscape.unescapeHtml(valueMatcher.group(1)) : ""; TopicUpdateEvent event = new TopicUpdateEvent(initiator, time, ((ChatGroup) chat).getTopic(), topic); skype.getEventDispatcher().callEvent(event); ((ChatGroup) chat).updateTopic(topic); } else { throw conformError("TopicUpdate"); } } },
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"option\" tags"); } final boolean selected = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "option")); if (selected) { StandardProcessorUtils.setAttribute(structureHandler, this.selectedAttributeDefinition, SELECTED_ATTR_NAME, SELECTED_ATTR_NAME); } else { structureHandler.removeAttribute(this.selectedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"option\" tags"); } final boolean selected = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "option")); if (selected) { StandardProcessorUtils.setAttribute(structureHandler, this.selectedAttributeDefinition, SELECTED_ATTR_NAME, SELECTED_ATTR_NAME); } else { structureHandler.removeAttribute(this.selectedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"option\" tags"); } final boolean selected = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "option")); if (selected) { StandardProcessorUtils.setAttribute(structureHandler, this.selectedAttributeDefinition, SELECTED_ATTR_NAME, SELECTED_ATTR_NAME); } else { structureHandler.removeAttribute(this.selectedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final IThymeleafBindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"option\" tags"); } final boolean selected = SpringSelectedValueComparator.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "option")); if (selected) { StandardProcessorUtils.setAttribute(structureHandler, this.selectedAttributeDefinition, SELECTED_ATTR_NAME, SELECTED_ATTR_NAME); } else { structureHandler.removeAttribute(this.selectedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"option\" tags"); } final boolean selected = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "option")); if (selected) { StandardProcessorUtils.setAttribute(structureHandler, this.selectedAttributeDefinition, SELECTED_ATTR_NAME, SELECTED_ATTR_NAME); } else { structureHandler.removeAttribute(this.selectedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final IThymeleafBindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, true); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"input(radio)\" tags"); } final boolean checked = SpringSelectedValueComparator.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio")); if (checked) { StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME); } else { structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, true); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"input(radio)\" tags"); } final boolean checked = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio")); if (checked) { StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME); } else { structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, true); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"input(radio)\" tags"); } final boolean checked = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio")); if (checked) { StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME); } else { structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, true); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"input(radio)\" tags"); } final boolean checked = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio")); if (checked) { StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME); } else { structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName()); } }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, true); final String value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName()); if (value == null) { throw new TemplateProcessingException( "Attribute \"value\" is required in \"input(radio)\" tags"); } final boolean checked = SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value)); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio")); if (checked) { StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME); } else { structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName()); } }