You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by David Calavera <da...@gmail.com> on 2010/05/18 14:54:34 UTC

SyndLinks are not serialized properly

Hi,

I'm trying to add links to my xml elements but I've seen they are not
properly serialized with the default jaxb provider. I expected to get
something like:

<link rel="self" href="/defects/3"/>

but actually I get this:

<links><href>http://localhost:9009/api/datacenters/1
</href><rel>edit</rel></links>

this is my code:

SingleLinkBuilder linkBuilder = linkProcessor.createSingleLinkBuilder();
>         List<SyndLink> links =
>
> linkBuilder.relativize(false).resource(DatacenterResource.class).pathParam(DATACENTER,
>
> datacenter.getId().toString()).rel("edit").build(datacenter.getLinks());
>

I suppose the problem is that SyndLink.java doesn't have the fields
annotated with @XmlAttribute.

Could you please verify that it generates the expected format? I didn't find
any test about it. I can file a bug with a patch otherwise.

On the other hand, I'm creating my links one by one with the
SingleLinkBuilder but it's quite annoying that the build method has to
receive a list of links and returns a list as well when you are building
just one link.

Cheers

Re: SyndLinks are not serialized properly

Posted by Jesse A Ramos <jr...@us.ibm.com>.
Hi,

You are correct that this is happening because the fields in SyndLink are 
not annotated with @XmlAttribute.  We don't really support JAXB with the 
syndication objects.  Go ahead and open a JIRA if you would like this 
support to be added.  Of course we welcome user submitted contributions 
=).

I agree that it would be more convenient to add a method to 
SingleLinkBuilder that doesn't require a List as input and will return 
just a single SyndLink.  I can add this if you want to open a JIRA for 
this as well.





From:
David Calavera <da...@gmail.com>
To:
wink-user@incubator.apache.org
Date:
05/18/2010 07:55 AM
Subject:
SyndLinks are not serialized properly



Hi,

I'm trying to add links to my xml elements but I've seen they are not 
properly serialized with the default jaxb provider. I expected to get 
something like:

<link rel="self" href="/defects/3"/>

but actually I get this:

<links><href>http://localhost:9009/api/datacenters/1
</href><rel>edit</rel></links>

this is my code:

SingleLinkBuilder linkBuilder = linkProcessor.createSingleLinkBuilder();
        List<SyndLink> links =
            
linkBuilder.relativize(false).resource(DatacenterResource.class).pathParam(DATACENTER,
                
datacenter.getId().toString()).rel("edit").build(datacenter.getLinks());

I suppose the problem is that SyndLink.java doesn't have the fields 
annotated with @XmlAttribute.

Could you please verify that it generates the expected format? I didn't 
find any test about it. I can file a bug with a patch otherwise.

On the other hand, I'm creating my links one by one with the 
SingleLinkBuilder but it's quite annoying that the build method has to 
receive a list of links and returns a list as well when you are building 
just one link.

Cheers