Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 975F47674 for ; Mon, 12 Sep 2011 12:06:09 +0000 (UTC) Received: (qmail 54652 invoked by uid 500); 12 Sep 2011 12:06:08 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 51517 invoked by uid 500); 12 Sep 2011 12:05:49 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Delivered-To: moderator for users@jackrabbit.apache.org Received: (qmail 89559 invoked by uid 99); 12 Sep 2011 11:28:10 -0000 X-ASF-Spam-Status: No, hits=-0.4 required=5.0 tests=ASF_LIST_OPS,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of parvez12@gmail.com designates 209.85.161.172 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=xee2/hdHbDuU4/9xC4rR6himrOEv1Gm9AGbEYe8Os/c=; b=NmNoNhyffWtbWcEgSMHaSwd8R5xYrAdpLYW8Oq4G/pPJXU0pfdYNRbOGbkhwEUuxsx Lijx97O8NE5J6MCOFL0GKLpezsoM9SiLW/TNmvn/H5egLK3dBWx8XY0iMF3FmFnpBHpa 4JJiFBZCgBT4YokuvIVYUB/vTSl5OkcfvBfDE= MIME-Version: 1.0 Date: Mon, 12 Sep 2011 16:57:39 +0530 Message-ID: Subject: version creation using httpclient From: Parvez Ahmad To: users@jackrabbit.apache.org, user@jackrabbit.apache.org, users-help@jackrabbit.apache.org, users-owner@jackrabbit.apache.org Content-Type: multipart/alternative; boundary=000e0cd6a8b28d534c04acbcd038 --000e0cd6a8b28d534c04acbcd038 Content-Type: text/plain; charset=UTF-8 Sir, My best regards. I am fan of jackrabbit team and make my living by use of your invention-- jackrabbit. I am struggling to create version for a file from last 15 days. Version is getting created but I am unable to retrieve the version labels using code. I use jackrabit/apache sling. I want to retrieve version labels. Please help regards Ahmad Srinagar Kashmir India Sample code i use is :- public void createVersion(String un_encoded_virtual_Path){ String virtualPath = Utility.encodePath(un_encoded_virtual_Path); String remotePath = getServerRoot() + virtualPath; int status; try { VersionControlMethod vcMethod = new VersionControlMethod(remotePath); executeMethod(vcMethod); vcMethod.releaseConnection(); // execute check in and check out methods if(urlExists(remotePath)){ /** CheckoutMethod checkOut = new CheckoutMethod(remotePath); executeMethod(checkOut); checkOut.releaseConnection(); */ CheckinMethod checkIn = new CheckinMethod(remotePath); executeMethod(checkIn); checkIn.releaseConnection(); } LabelMethod lbMethod = new LabelMethod(remotePath,"FLINTOFF", LabelInfo.TYPE_ADD); status = executeMethod(lbMethod); System.out.println("status : " + status + "--" + lbMethod.getResponseBodyAsString()); } catch (Exception e2){ e2.printStackTrace(); } } public List getVersions(String un_encoded_virtual_Path){ List lstVersions = new ArrayList(); String virtualPath = Utility.encodePath(un_encoded_virtual_Path); String remotePath = getServerRoot() + virtualPath; try { /// get versions // create the report /// HERE I SEE THE PROBLEM ReportInfo reportInfo = new ReportInfo(ReportType.VERSION_TREE ,DavConstants.DEPTH_INFINITY); ReportMethod report = new ReportMethod(remotePath, reportInfo); client.executeMethod(report); MultiStatus multiStatus = report.getResponseBodyAsMultiStatus(); MultiStatusResponse responses[] = multiStatus.getResponses(); String responseAsString = ""; VersionVo v; for(int i = 0; i < responses.length; i++) { responseAsString += responses[i].getHref() + "\n"; v = new VersionVo(); v.setVersionNodePath(responses[i].getHref()); v.setVersionComment("version-" +i++); v.setCreatedDate("hhhhh"); lstVersions.add(v); } report.releaseConnection(); } catch (Exception e2){ e2.printStackTrace(); } return lstVersions; } --000e0cd6a8b28d534c04acbcd038--