The restfulie-java version should return an specific resource even
when no MediaType have been registered?
Response response = Restfulie.at("http://mydomain.com/item/1").get();
// How it is supposed to know that he should marshall for this Item class?
Item item = response.getResource();
Or we will always have to provide the types been marshall/unmarshall?
Restfulie client = Restfulie.custom();
// annotating the Item class with @XStreamAlias
client.register(new XmlMediaType().withTypes(Item.class));
Regards.
By default, there are already a few media type drivers registered, so
if they know how to deserialize an Item by default, great! (1st
example)
If they don't, so you need to teach them (2nd example).
Unlike Rails and Ruby where devs write their app code without any
namespace, in Java we use packages all the time. That means the
deserializer wont know where the <item> ==> "Item" class is to be
found. So the minimal config would be to set up a default package and
load classes from that package.
Using the xstream based xml driver, that means just changing how
xstream behaves by default with unknown elements
What do you think?
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
The first example won't be used frequently, right? Cos' as you said we
are always using packages.
I was considering implement some package-scan, so that we can find any
class annotated with @XStreamAlias and register it automatically on
the defaults MediaTypes. Dunno if it is the same think you said about
changing XStream default behaviour.
What would that be like?
Regards.
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/