Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ABA22185F4 for ; Tue, 28 Apr 2015 09:31:10 +0000 (UTC) Received: (qmail 31721 invoked by uid 500); 28 Apr 2015 09:31:09 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 31652 invoked by uid 500); 28 Apr 2015 09:31:09 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 31629 invoked by uid 99); 28 Apr 2015 09:31:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 09:31:09 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: message received from 54.191.145.13 which is an MX secondary for users@cxf.apache.org) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 09:31:04 +0000 Received: from mail-wg0-f54.google.com (mail-wg0-f54.google.com [74.125.82.54]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id C3D05283FF; Tue, 28 Apr 2015 09:30:32 +0000 (UTC) Received: by wgso17 with SMTP id o17so144574933wgs.1; Tue, 28 Apr 2015 02:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=7DAVD2+L6DglwZDZsbCd72+oZ+eYnB0A13ubzBlTxpg=; b=EYMu8hL9vKRk9PwWwKEBG9b7ieLz6r0kWhy+bbRMgKVxweb2vg5CP60voVqDSVWrN3 edf/rGFWd9Z6qlWgKE+phrnNfBOkCCUIC7tlwUUL7BfLoaBuJrxtY0JuvIx65Yszj26z TkSd9XBSBWL7yTvr0WLVwfC/3V8z8jXYT6TXagqgd5Xb682MKZSdcrZmhDktbrKVVNSJ JyNvaQwDFWxnfgNPPnxwUaDMwy8GnRh6YwheyROY+zq78VP354pXh9Yk3YoelW1n/DFk F49CzpqBIcj5EK3G/Obz1yX8V1pLCHpthj2PcMWruAKGJcArVadHl6PbZM5hCRYNrWNs cEmw== X-Received: by 10.180.160.145 with SMTP id xk17mr28430305wib.85.1430213380599; Tue, 28 Apr 2015 02:29:40 -0700 (PDT) Received: from [192.168.2.7] ([109.255.35.30]) by mx.google.com with ESMTPSA id ju2sm15460519wid.12.2015.04.28.02.29.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 02:29:39 -0700 (PDT) Message-ID: <553F5302.1010909@gmail.com> Date: Tue, 28 Apr 2015 10:29:38 +0100 From: Sergey Beryozkin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: users@cxf.apache.org CC: dev@cxf.apache.org Subject: Re: The logic of Response getAllLinks method is not good? References: <1430201994093-5756610.post@n5.nabble.com> <553F5261.1040006@gmail.com> In-Reply-To: <553F5261.1040006@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org One more option "/post" ? So is it "post", "../post", or "/post" ? Sergey On 28/04/15 10:26, Sergey Beryozkin wrote: > Hi > > Thanks for this analysis, I'm looking at the docs, example > > https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/Response.html#getLink(java.lang.String) > > > it says: > > "A relative link is resolved with respect to the actual request URI that > produced this response". > > What is the link value in your case, "../post" or "post" ? > > Thanks, Sergey > > > > On 28/04/15 07:19, ellen wrote: >> Hi all, >> >> I'm using response getLink method from CXF. >> >> The code is: >> >> private Map getAllLinks() { >> List linkValues = metadata.get(HttpHeaders.LINK); >> if (linkValues == null) { >> return Collections.emptyMap(); >> } else { >> Map links = new LinkedHashMap(); >> for (Object o : linkValues) { >> Link link = o instanceof Link ? (Link)o : >> Link.valueOf(o.toString()); >> if (!link.getUri().isAbsolute()) { >> *URI requestURI = >> URI.create((String)outMessage.get(Message.REQUEST_URI));* >> link = >> Link.fromLink(link).baseUri(requestURI).build(); >> } >> links.put(link.getRel(), link); >> } >> return links; >> } >> } >> >> But from the code you can see therequestURI comes from Message >> REQUEST_URI. >> >> If my request uri is http://www.test.com/resource/get >> >> then I continue use the link to invoke like this: >> >> Link link = response.getLink(linkName); >> response = client.invocation(link).post(null); >> >> The url which response use is joined like this: >> http://www.test.com/resource/get/post, >> >> but this http://www.test.com/resource/get/post is not exist (correct lin >> should be http://www.test.com/resource/post). So I think this is not >> good. >> >> I'm looking at Jersey getLink method, and found they use: >> URI result = baseUri.resolve(refUri); >> >> to get Request url, and I found the result is correct for me. >> >> Could you please take a look this issue? >> >> Thanks a lot! >> >> >> >> -- >> View this message in context: >> http://cxf.547215.n5.nabble.com/The-logic-of-Response-getAllLinks-method-is-not-good-tp5756610.html >> >> Sent from the cxf-dev mailing list archive at Nabble.com. >> > -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com