RE: Representation for multiple types?

2010-02-20 Thread Jerome Louvel
De : Matt Kennedy [mailto:stinkym...@gmail.com] Envoyé : lundi 25 janvier 2010 06:10 À : discuss@restlet.tigris.org Objet : Re: Representation for multiple types? Can you just use the sample code you provide below, only create a subclass of Representation that takes your serializer as the arg

Re: Representation for multiple types?

2010-01-24 Thread Matt Kennedy
Can you just use the sample code you provide below, only create a subclass of Representation that takes your serializer as the argument, maybe along with the mime type? Something like: public class MyVariableRepresentation extends Representation { Serializer serializer; public MyVariableRepr

Re: Representation for multiple types?

2010-01-23 Thread Stephan Koops
Hi Jean-Philipee, there is the converter service, perhaps it helps you. Unfortunately I can't give you details. best regards Stephan Jean-Philippe Steinmetz schrieb: > Thank you for the quick reply. This certainly would resolve the issue > but it doesn't really offer the kind of solution I

Re: Representation for multiple types?

2010-01-22 Thread Jean-Philippe Steinmetz
Sure. With our particular use case we specify a map of media types to data serializers in spring as a hash map. We then inject this map into each resource. When the map is set in the class we then add all the media types specified as map keys as acceptable variants. When the represent() function is

Re: Representation for multiple types?

2010-01-22 Thread Matt Kennedy
I'm not a Spring user, so maybe that's why it isn't clear to me what you're asking. Can you try phrasing this question a different way? I think I know the answer to your problem because I've always had to deal with multiple media types for the same resource, but I'm not sure I understand the p

Re: Representation for multiple types?

2010-01-22 Thread Jean-Philippe Steinmetz
Thank you for the quick reply. This certainly would resolve the issue but it doesn't really offer the kind of solution I was hoping for. With this solution i'd still have to do a mapping of media type to some representation which is what I am trying to avoid. The thought was that there is a Represe

Re: Representation for multiple types?

2010-01-22 Thread Matt Kennedy
I can't remember what 1.1.6's API looks like, but I do something like this with the 2.0 API. Basically, in the Resource's constructor, I use someting like: getVariants().add(new MyXMLRepresentation(this)) getVariants().add(new MyJSONRepresentation(this)) Each of those My* classes are a subclas

Representation for multiple types?

2010-01-22 Thread Jean-Philippe Steinmetz
Hello all, We're using restlet 1.1.6 and for all our resources we want to support a dynamic set of media types. We do this in our Spring configuration by setting up a list of acceptable media types. My question is if there is a Representation class I can use that will essentially accept any type o