You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by iris ding <ir...@gmail.com> on 2015/04/15 16:20:40 UTC

ContainerResponseContext.getLinks() lose links

HI,
In org.apache.cxf.jaxrs.impl.ResponseImpl.getAllLinks() , we put link into a
LinkedHashMap and use link.getRel() as key:
links.put(link.getRel(), link);
However, link.getRel() may return null, in such case, we will lose links if
multiple links's rel is null due to duplicate key.
See below javadoc for Link:
getRel()
Returns the value associated with the link rel param, or null if this param
is not specified.

Can you please take a look at the problem? I have already created a jira
https://issues.apache.org/jira/browse/CXF-6352 for it and attached a
proposed fix.

Thanks a lot!

Iris Ding



--
View this message in context: http://cxf.547215.n5.nabble.com/ContainerResponseContext-getLinks-lose-links-tp5756063.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: ContainerResponseContext.getLinks() lose links

Posted by iris ding <ir...@gmail.com>.
Thanks Sergey  for taking care of this issue.

In my test, I just use below two links:

http://localhost:9080/xxxx/rest/resource/getlinks
html://localhost:8080/nohttp


Iris Ding



--
View this message in context: http://cxf.547215.n5.nabble.com/ContainerResponseContext-getLinks-lose-links-tp5756063p5756227.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: ContainerResponseContext.getLinks() lose links

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

Thanks for your patch and sorry I forgot to mention your name in the 
commit message, the fact you did a patch was appreciated.

I'm not sure to be honest what does it mean to have multiple Links 
without a relationship, how would you identify which URI points to what 
? May be you use some custom parameters for that but if so then you can 
equally model that with a 'rel'.

Either way, technically it was a bug, thanks for identifying it

Sergey
On 15/04/15 15:20, iris ding wrote:
> HI,
> In org.apache.cxf.jaxrs.impl.ResponseImpl.getAllLinks() , we put link into a
> LinkedHashMap and use link.getRel() as key:
> links.put(link.getRel(), link);
> However, link.getRel() may return null, in such case, we will lose links if
> multiple links's rel is null due to duplicate key.
> See below javadoc for Link:
> getRel()
> Returns the value associated with the link rel param, or null if this param
> is not specified.
>
> Can you please take a look at the problem? I have already created a jira
> https://issues.apache.org/jira/browse/CXF-6352 for it and attached a
> proposed fix.
>
> Thanks a lot!
>
> Iris Ding
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/ContainerResponseContext-getLinks-lose-links-tp5756063.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>