public HTTPStatus doHead(String path) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); HTTPStatus status = performHttpRequest(httpConnection, "HEAD", path, null, (StringBuffer)null, 404, 0, null, null); return status; }
public HTTPStatus doOptions(String path) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "OPTIONS", path, null, DAVOptionsHandler.OPTIONS_REQUEST, 200, 0, null, null); }
public HTTPStatus doDelete(String path) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "DELETE", path, null, (StringBuffer) null, 404, 204, null, null); }
public HTTPStatus doPropfind(String path, HTTPHeader header, StringBuffer body, DefaultHandler handler) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "PROPFIND", path, header, body, -1, 0, null, handler); }
public HTTPStatus doMakeCollection(String path) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "MKCOL", path, null, (StringBuffer) null, 201, 0, null, null); }
public void doGet(String path, OutputStream os) throws SVNException { beforeCall(); SVNErrorMessage context = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "GET request failed for ''{0}''", path); IHTTPConnection httpConnection = getConnection(); performHttpRequest(httpConnection, "GET", path, null, (StringBuffer) null, 200, 226, os, null, context); }
public HTTPStatus doPost(String path, String mimeType, byte[] body) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); HTTPHeader header = new HTTPHeader(); if (mimeType != null) { header.setHeaderValue(HTTPHeader.CONTENT_TYPE_HEADER, mimeType); } HTTPStatus status = performHttpRequest(httpConnection, "POST", path, header, body, 404, 201, null, null); return status; }
public void doGet(String path, String deltaBaseVersionURL, OutputStream os) throws SVNException { beforeCall(); HTTPHeader header = null; if (deltaBaseVersionURL != null) { header = new HTTPHeader(); header.addHeaderValue(HTTPHeader.SVN_DELTA_BASE_HEADER, deltaBaseVersionURL); } SVNErrorMessage context = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "GET request failed for ''{0}''", path); IHTTPConnection httpConnection = getConnection(); performHttpRequest(httpConnection, "GET", path, header, (StringBuffer) null, 200, 226, os, null, context); }
public HTTPStatus doPutDiff(String repositoryPath, String path, InputStream data, long size, String baseChecksum, String textChecksum) throws SVNException { beforeCall(); HTTPHeader headers = new HTTPHeader(); headers.setHeaderValue(HTTPHeader.CONTENT_TYPE_HEADER, HTTPHeader.SVNDIFF_MIME_TYPE); headers.setHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER, size + ""); if (myLocks != null && myLocks.containsKey(repositoryPath)) { headers.setHeaderValue(HTTPHeader.IF_HEADER, "<" + repositoryPath + "> (<" + myLocks.get(repositoryPath) + ">)"); } if (baseChecksum != null) { headers.setHeaderValue(HTTPHeader.BASE_MD5, baseChecksum); } if (textChecksum != null) { headers.setHeaderValue(HTTPHeader.TEXT_MD5, textChecksum); } IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "PUT", path, headers, data, 201, 204, null, null); }
private String getActivityCollectionURL(String path, boolean force) throws SVNException { if (!force && myActivityCollectionURL != null) { return myActivityCollectionURL; } DAVOptionsHandler handler = new DAVOptionsHandler(); IHTTPConnection httpConnection = getConnection(); performHttpRequest(httpConnection, "OPTIONS", path, null, DAVOptionsHandler.OPTIONS_REQUEST, -1, 0, null, handler); myActivityCollectionURL = handler.getActivityCollectionURL(); if (myActivityCollectionURL == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_DAV_OPTIONS_REQ_FAILED, "The OPTIONS request did not include the requested activity-collection-set; this often means that the URL is not WebDAV-enabled"); SVNErrorManager.error(err, SVNLogType.NETWORK); } return myActivityCollectionURL; }
public HTTPStatus doReport(String path, StringBuffer requestBody, DefaultHandler handler, boolean spool) throws SVNException { beforeCall(); IHTTPConnection httpConnection = getConnection(); httpConnection.setSpoolResponse(spool || isReportResponseSpooled()); try { HTTPHeader header = new HTTPHeader(); header.addHeaderValue(HTTPHeader.ACCEPT_ENCODING_HEADER, "svndiff1;q=0.9,svndiff;q=0.8"); return performHttpRequest(httpConnection, "REPORT", path, header, requestBody, -1, 0, null, handler); } finally { httpConnection.setSpoolResponse(false); } }
public void doProppatch(String repositoryPath, String path, StringBuffer requestBody, DefaultHandler handler, SVNErrorMessage context) throws SVNException { beforeCall(); HTTPHeader header = null; if (myLocks != null && repositoryPath != null && myLocks.containsKey(repositoryPath)) { header = new HTTPHeader(); header.setHeaderValue(HTTPHeader.IF_HEADER, "(<" + myLocks.get(repositoryPath) + ">)"); } IHTTPConnection httpConnection = getConnection(); try { performHttpRequest(httpConnection, "PROPPATCH", path, header, requestBody, 200, 207, null, handler, context); } catch (SVNException e) { HTTPStatus status = httpConnection.getLastStatus(); if (status != null) { switch (status.getCode()) { case 423: SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''; repository is unchanged", new Object[]{path}); SVNErrorManager.error(err, e, SVNLogType.NETWORK); break; default: break; } } SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_DAV_PROPPATCH_FAILED, "At least one property change failed; repository is unchanged"); SVNErrorManager.error(err, e, SVNLogType.NETWORK); } }
public void doCopy(String src, String dst, int depth) throws SVNException { beforeCall(); HTTPHeader header = new HTTPHeader(); header.setHeaderValue(HTTPHeader.DESTINATION_HEADER, dst); header.setHeaderValue(HTTPHeader.DEPTH_HEADER, depth > 0 ? "infinity" : "0"); SVNErrorMessage context = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "COPY of {0}", src); IHTTPConnection httpConnection = getConnection(); HTTPStatus status = performHttpRequest(httpConnection, "COPY", src, header, (StringBuffer) null, -1, 0, null, null, context); if (status.getCode() >= 300 && status.getError() != null) { SVNErrorMessage err = status.getError(); SVNErrorManager.error(err, SVNLogType.NETWORK); } }
HTTPStatus status = performHttpRequest(httpConnection, "CHECKOUT", path, header, request, 201, allow404 ? 404 : 0, null, null); if (allow404 && status.getCode() == 404 && status.getError() != null) { status.setError(null);
public String doMakeActivity(ISVNWorkspaceMediator mediator) throws SVNException { beforeCall(); String url = null; if (mediator != null) { SVNPropertyValue property = mediator.getWorkspaceProperty("", SVNProperty.ACTIVITY_URL); if (property != null && property.isString()) { url = property.getString(); } } String locationPath = SVNEncodingUtil.uriEncode(getLocation().getPath()); if (url == null) { url = getActivityCollectionURL(locationPath, false); } IHTTPConnection httpConnection = getConnection(); String activityURL = SVNPathUtil.append(url, generateUUID()); HTTPStatus status = performHttpRequest(httpConnection, "MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 404, null, null); if (status.getCode() == 404) { url = getActivityCollectionURL(locationPath, true); activityURL = SVNPathUtil.append(url, generateUUID()); status = performHttpRequest(httpConnection, "MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 0, null, null); } if (url != null && mediator != null) { mediator.setWorkspaceProperty("", SVNProperty.ACTIVITY_URL, SVNPropertyValue.create(url)); } return activityURL; }
public HTTPStatus doMerge(String activityURL, boolean response, DefaultHandler handler) throws SVNException { beforeCall(); String locationPath = SVNEncodingUtil.uriEncode(getLocation().getPath()); StringBuffer request = DAVMergeHandler.generateMergeRequest(null, locationPath, activityURL, myLocks); HTTPHeader header = null; if (!response || (myLocks != null && !myKeepLocks)) { header = new HTTPHeader(); String value = ""; if (!response) { value += "no-merge-response"; } if (myLocks != null && !myKeepLocks) { value += " release-locks"; } header.setHeaderValue(HTTPHeader.SVN_OPTIONS_HEADER, value); } IHTTPConnection httpConnection = getConnection(); return performHttpRequest(httpConnection, "MERGE", getLocation().getURIEncodedPath(), header, request, -1, 0, null, handler); }
public SVNLock doGetLock(String path, DAVRepository repos) throws SVNException { beforeCall(); DAVBaselineInfo info = DAVUtil.getBaselineInfo(this, repos, path, -1, false, true, null); StringBuffer body = DAVLockHandler.generateGetLockRequest(null); DAVLockHandler handler = new DAVLockHandler(); SVNErrorMessage context = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Failed to fetch lock information"); IHTTPConnection httpConnection = getConnection(); HTTPStatus rc = performHttpRequest(httpConnection, "PROPFIND", path, null, body, 200, 207, null, handler, context); String id = handler.getID(); if (id == null) { return null; } String comment = handler.getComment(); String owner = rc.getHeader().getFirstHeaderValue(HTTPHeader.LOCK_OWNER_HEADER); String created = rc.getHeader().getFirstHeaderValue(HTTPHeader.CREATION_DATE_HEADER); Date createdDate = created != null ? SVNDate.parseDate(created) : null; path = SVNEncodingUtil.uriDecode(info.baselinePath); if (!path.startsWith("/")) { path = "/" + path; } return new SVNLock(path, id, owner, comment, createdDate, null); }
protected void exchangeCapabilities(SVNURL[] correctedUrl) throws SVNException { String path = SVNEncodingUtil.uriEncode(getLocation().getPath()); IHTTPConnection httpConnection = getConnection(); HTTPStatus status = performHttpRequest(httpConnection, "OPTIONS", path, null, DAVOptionsHandler.OPTIONS_REQUEST, 200, 0, null, null);
IHTTPConnection httpConnection = getConnection(); try { myLastStatus = performHttpRequest(httpConnection, "LOCK", path, header, body, -1, 0, null, handler, context); } catch (SVNException e) { myLastStatus = httpConnection.getLastStatus();
SVNException exception = null; try { myLastStatus = performHttpRequest(httpConnection, "UNLOCK", path, header, (StringBuffer) null, -1, 0, null, null, context); } catch (SVNException e) { myLastStatus = httpConnection.getLastStatus();