public String xmlEscape(final String text) { return XMLUtils.escape(text); } }
/** * If there is a suitable entity reference for this character, return it. The list of available entity references is * almost but not identical between XML and HTML. This uses a default transformation policy of replacing invalid XML * characters. * * @since 6.0 */ public static String escape(final int codePoint) { return escape(codePoint, DEFAULT_POLICY); }
/** * Escape an XML string using a default policy of replacing invalid XML characters. */ public static String escape(final String source) { return escape(source, DEFAULT_POLICY); }
/** * If there is a suitable entity reference for this character, return it. The list of available entity references is * almost but not identical between XML and HTML. This uses a default transformation policy of replacing invalid XML * characters. */ public static String escape(final char ch) { return escape(ch, DEFAULT_POLICY); }
/** * Escape an XML string using a default policy of replacing invalid XML characters. */ public static String escape(final String source) { return escape(source, DEFAULT_POLICY); }
/** * If there is a suitable entity reference for this character, return it. The list of available entity references is * almost but not identical between XML and HTML. This uses a default transformation policy of replacing invalid XML * characters. * * @deprecated use {@link com.atlassian.core.util.XMLUtils#escape(int)} instead */ @Deprecated public static String escape(final char ch) { return escape(ch, DEFAULT_POLICY); }
public String getCreateFromTemplateMacro(BlueprintContext context, String buttonLabel, String pluginKey) { String spaceKey = XMLUtils.escape(context.getSpaceKey()); String blueprintKey = XMLUtils.escape(context.getBlueprintModuleCompleteKey().getCompleteKey()); HashMap<String, Object> templateContext = Maps.newHashMap(); templateContext.put("blueprintKey", blueprintKey); templateContext.put("spaceKey", spaceKey); templateContext.put("buttonLabel", buttonLabel); return renderFromSoy(pluginKey, CREATE_FROM_TEMPLATE_MACRO, templateContext); }
public void writeIssue(Issue issue, AbstractIssueView issueView, Writer writer) throws IOException { if(log.isDebugEnabled()) { log.debug("About to write RSS view for issue [" + issue.getKey() + "]."); } Map bodyParams = JiraVelocityUtils.getDefaultVelocityParams(authenticationContext); String htmlBody = issueView.getBody(issue, searchRequestParams); bodyParams.put("issue", issue); bodyParams.put("issueDescription", XMLUtils.escape(styleSheet + " " + htmlBody)); String body = descriptor.getHtml("view", bodyParams); writer.write(body); } };
private void writeDummyXMLResponse(final HttpServletResponse response) throws IOException { response.setContentType("text/xml"); final String baseUrl = velocityRequestContextFactory.getJiraVelocityRequestContext().getBaseUrl(); final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n"); sb.append("<!-- RSS generated by JIRA ").append(buildUtilsInfo.getVersion()).append(" at ").append(dateTimeFormatterFactory.formatter().withStyle(DateTimeStyle.RSS_RFC822_DATE_TIME).withSystemZone().format(new Date())).append( " -->\n"); sb.append("<rss version=\"0.92\">\n"); sb.append("<channel>\n"); sb.append("\t<title>").append(XMLUtils.escape(applicationProperties.getString(APKeys.JIRA_TITLE))).append("</title>\n"); sb.append("\t<link>").append(XMLUtils.escape(baseUrl)).append("</link>\n"); sb.append("\t<description>").append(XMLUtils.escape(i18n.getInstance(authenticationContext.getLocale()).getText("issue.views.xml.some.desc"))).append("</description>\n"); final String rssLocale = RssViewUtils.getRssLocale(authenticationContext.getLocale()); if (rssLocale != null) { sb.append("\t<language>").append(rssLocale).append("</language>\n"); } sb.append("<build-info>"); sb.append("\t<version>").append(XMLUtils.escape(buildUtilsInfo.getVersion())).append("</version>"); sb.append("\t<build-number>").append(XMLUtils.escape(buildUtilsInfo.getCurrentBuildNumber())).append("</build-number>"); sb.append("\t<build-date>").append(XMLUtils.escape(new SimpleDateFormat("dd-MM-yyyy").format(buildUtilsInfo.getCurrentBuildDate()))).append("</build-date>"); sb.append("</build-info>"); sb.append("</channel>\n"); sb.append("</rss>\n"); final PrintWriter out = response.getWriter(); out.write(sb.toString()); out.flush(); }
@Override protected BlueprintContext updateBlueprintContext(BlueprintContext context) { String spaceKey = XMLUtils.escape(context.getSpaceKey()); String blueprintKey = XMLUtils.escape(context.getBlueprintModuleCompleteKey().getCompleteKey()); context.put("createFromTemplateMacro", getCreateFromTemplateMacro(blueprintKey, spaceKey)); return context; }
throw new ResponseException(String.format("Failed to parse FishEye response: %s", XMLUtils.escape(e.getMessage())), e);
throw new ResponseException(String.format("Failed to parse FishEye response: %s", XMLUtils.escape(e.getMessage())), e);