public static String xmlEncodeCDATA(String src) { return xmlEncodeCDATA(src, false); }
public static String xmlEncodeCDATA(String src) { return xmlEncodeCDATA(src, false); }
public static String xmlEncodeCDATA(String src) { return xmlEncodeCDATA(src, false); }
public void deletePath(String path) { report.append("<S:missing>"); report.append(SVNEncodingUtil.xmlEncodeCDATA(path)); report.append("</S:missing>\n"); }
/** * Handles CData characters. * * @param ch * @param start * @param length * @throws SAXException */ public void characters(char[] ch, int start, int length) throws SAXException { myCharacters = true; try { String cdata = SVNEncodingUtil.xmlEncodeCDATA(new String(ch, start, length)); myWriter.write(cdata); } catch (IOException e) { throw new SAXException(e); } }
/** * Handles CData characters. * * @param ch * @param start * @param length * @throws SAXException */ public void characters(char[] ch, int start, int length) throws SAXException { myCharacters = true; try { String cdata = SVNEncodingUtil.xmlEncodeCDATA(new String(ch, start, length)); myWriter.write(cdata); } catch (IOException e) { throw new SAXException(e); } }
/** * Handles CData characters. * * @param ch * @param start * @param length * @throws SAXException */ public void characters(char[] ch, int start, int length) throws SAXException { myCharacters = true; try { String cdata = SVNEncodingUtil.xmlEncodeCDATA(new String(ch, start, length)); myWriter.write(cdata); } catch (IOException e) { throw new SAXException(e); } }
public static StringBuffer generateFileRevisionsRequest(StringBuffer buffer, long startRevision, long endRevision, String path) { buffer = buffer == null ? new StringBuffer() : buffer; buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); buffer.append("<S:file-revs-report xmlns:S=\"svn:\">"); if (startRevision >= 0) { buffer.append("<S:start-revision>" + startRevision + "</S:start-revision>"); } if (endRevision >= 0) { buffer.append("<S:end-revision>" + endRevision + "</S:end-revision>"); } buffer.append("<S:path>" + SVNEncodingUtil.xmlEncodeCDATA(path) + "</S:path>"); buffer.append("</S:file-revs-report>"); return buffer; }
public void setPath(String path, String locktoken, long revision, boolean startEmpty) { report.append("<S:entry rev=\""); report.append(revision); report.append("\" "); if (locktoken != null) { report.append("lock-token=\""); report.append(locktoken); report.append("\" "); } if (startEmpty) { report.append("start-empty=\"true\" "); } report.append(">"); report.append(SVNEncodingUtil.xmlEncodeCDATA(path)); report.append("</S:entry>\n"); }
public static StringBuffer generateLocationsRequest(StringBuffer buffer, String path, long pegRevision, long[] revisions) { buffer = buffer == null ? new StringBuffer() : buffer; buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); buffer.append("<S:get-locations xmlns:S=\"svn:\" xmlns:D=\"DAV:\" >"); buffer.append("<S:path>"); buffer.append(SVNEncodingUtil.xmlEncodeCDATA(path)); buffer.append("</S:path>"); buffer.append("<S:peg-revision>"); buffer.append(pegRevision); buffer.append("</S:peg-revision>"); for(int i = 0; i < revisions.length; i++) { buffer.append("<S:location-revision>"); buffer.append(revisions[i]); buffer.append("</S:location-revision>"); } buffer.append("</S:get-locations>"); return buffer; }
protected void appendServerSignature(StringBuffer buffer, String prefix) { buffer.append(prefix); buffer.append("<address>"); ServletContext context = myRepositoryManager.getServletContext(); buffer.append(context.getServerInfo()); buffer.append(" "); buffer.append(Version.getVersionString()); buffer.append(" "); String host = myRequest.getServerName(); buffer.append("Server at "); buffer.append(SVNEncodingUtil.xmlEncodeCDATA(host)); buffer.append(" Port "); int port = myRequest.getServerPort(); buffer.append(port); buffer.append("</address>\n"); }
public static StringBuffer generateLockDataRequest(StringBuffer target, String root, String path, Map locks) { target = target == null ? new StringBuffer() : target; target.append("<S:lock-token-list xmlns:S=\"svn:\">"); for (Iterator paths = locks.keySet().iterator(); paths.hasNext();) { String lockPath = (String) paths.next(); if (path == null || isChildPath(path, lockPath)) { String token = (String) locks.get(lockPath); target.append("<S:lock><S:lock-path>"); lockPath = getRelativePath(lockPath, root); target.append(SVNEncodingUtil.xmlEncodeCDATA(SVNEncodingUtil.uriDecode(lockPath))); target.append("</S:lock-path><S:lock-token>"); target.append(token); target.append("</S:lock-token></S:lock>"); } } target.append("</S:lock-token-list>"); return target; }
public static StringBuffer openCDataTag(String prefix, String tagName, String cdata, Map attributes, boolean escapeQuotes, boolean encodeCDATA, StringBuffer target) { if (cdata == null) { return target; } target = openXMLTag(prefix, tagName, XML_STYLE_PROTECT_CDATA, attributes, target); if (encodeCDATA) { target.append(SVNEncodingUtil.xmlEncodeCDATA(cdata, escapeQuotes)); } else { target.append(cdata); } target = closeXMLTag(prefix, tagName, target); return target; }
public static StringBuffer openCDataTag(String prefix, String tagName, String cdata, Map attributes, boolean escapeQuotes, boolean encodeCDATA, StringBuffer target) { if (cdata == null) { return target; } target = openXMLTag(prefix, tagName, XML_STYLE_PROTECT_CDATA, attributes, target); if (encodeCDATA) { target.append(SVNEncodingUtil.xmlEncodeCDATA(cdata, escapeQuotes)); } else { target.append(cdata); } target = closeXMLTag(prefix, tagName, target); return target; }
protected void addTag(String tagName, String value) throws SAXException { if (mySharedAttributes == null) { mySharedAttributes = new AttributesImpl(); } getHandler().startElement("", "", tagName, mySharedAttributes); mySharedAttributes.clear(); value = value == null ? "" : value; value = SVNEncodingUtil.xmlEncodeCDATA(value); getHandler().characters(value.toCharArray(), 0, value.length()); getHandler().endElement("", "", tagName); }
public static StringBuffer openCDataTag(String prefix, String tagName, String cdata, Map attributes, boolean escapeQuotes, boolean encodeCDATA, StringBuffer target) { if (cdata == null) { return target; } target = openXMLTag(prefix, tagName, XML_STYLE_PROTECT_CDATA, attributes, target); if (encodeCDATA) { target.append(SVNEncodingUtil.xmlEncodeCDATA(cdata, escapeQuotes)); } else { target.append(cdata); } target = closeXMLTag(prefix, tagName, target); return target; }
public String getETag() { if (lacksETagPotential()) { return null; } long createdRevision = -1; try { createdRevision = getCreatedRevisionUsingFS(null); } catch (SVNException svne) { return null; } StringBuffer eTag = new StringBuffer(); eTag.append(isCollection() ? "W/" : ""); eTag.append("\""); eTag.append(createdRevision); eTag.append("/"); eTag.append(SVNEncodingUtil.xmlEncodeCDATA(getResourceURI().getPath(), true)); eTag.append("\""); return eTag.toString(); }
public void handleLocationSegment(SVNLocationSegment locationSegment) throws SVNException { maybeSendOpener(); Map attrs = new HashMap(); String path = locationSegment.getPath(); if (path != null) { path = DAVPathUtil.dropLeadingSlash(path); String quotedPath = SVNEncodingUtil.xmlEncodeCDATA(path, true); attrs.put(PATH_ATTR, quotedPath); attrs.put(RANGE_START_ATTR, String.valueOf(locationSegment.getStartRevision())); attrs.put(RANGE_END_ATTR, String.valueOf(locationSegment.getEndRevision())); } else { attrs.put(RANGE_START_ATTR, String.valueOf(locationSegment.getStartRevision())); attrs.put(RANGE_END_ATTR, String.valueOf(locationSegment.getEndRevision())); } StringBuffer buffer = SVNXMLUtil.openXMLTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, LOCATION_SEGMENT_TAG, SVNXMLUtil.XML_STYLE_SELF_CLOSING, attrs, null); write(buffer); }
protected void handleDAVCreated(String location, String what, boolean isReplaced) throws SVNException { if (location == null) { location = getURI(); } if (isReplaced) { setResponseStatus(HttpServletResponse.SC_NO_CONTENT); return; } setResponseHeader(HTTPHeader.LOCATION_HEADER, constructURL(location)); String body = what + " " + SVNEncodingUtil.xmlEncodeCDATA(location) + " has been created."; response(body, DAVServlet.getStatusLine(HttpServletResponse.SC_CREATED), HttpServletResponse.SC_CREATED); }
public void execute() throws SVNException { DAVResource resource = getRequestedDAVResource(false, false); FSRepository repos = (FSRepository) resource.getRepository(); myFSFS = repos.getFSFS(); readInput(true); if (resource.exists()) { throw new DAVException("<DAV:resource-must-be-null/>", HttpServletResponse.SC_CONFLICT, SVNLogType.NETWORK); } if (!resource.canBeActivity()) { throw new DAVException("<DAV:activity-location-ok/>", HttpServletResponse.SC_FORBIDDEN, SVNLogType.NETWORK); } try { makeActivity(resource); } catch (DAVException dave) { throw new DAVException("Could not create activity {0}.", new Object[] { SVNEncodingUtil.xmlEncodeCDATA(resource.getResourceURI().getURI()) }, dave.getResponseCode(), null, SVNLogType.NETWORK, Level.FINE, dave, null, null, 0, null); } setResponseHeader(CACHE_CONTROL_HEADER, CACHE_CONTROL_VALUE); handleDAVCreated(resource.getResourceURI().getURI(), "Activity", false); }