Hello,

this is simply called content negotiation (handled on server side). The HTTP protocol allows the HTTP client to set its preferences in some dedicated headers (ACCEPT, ACCEPT-LANGUAGE, etc. See => http://en.wikipedia.org/wiki/Content_negotiation). You can check the headers sent by your Internet browser, and you will get it. On server side, this mecanism relies only on the declaration of the variants supported by a resource. The framework automatically confronts the client preferences with the variants supported by the resource. So, from the developper point of view, you just have to list the supported variants.

NB: at this time in the Restlet framework, the content negotiation feature analyses the media-type and the languages preferences.

best regards,
THierry Boileau


Hi

Please verify  the following:

    * I understand that a Resource should at least determine one
      Variant in its Resource.getVariants() list which will probably
      created by "new Variant()" to initialize the media type; where
      every resource should  response with a MediaType.

    * I understand that you can create one Variant (say a
      DomRepresentation) to be returned by the default implementation
      of Resource.getRepresenation().


Also please answer the following question:
I don't get how a list of variants is used, I don't get how the Resource will choose a variant from that list. Also I did not find a way to determine Preferred Variant, Say you are sending HTTP get via a browser, how the request of the client determine the Variant which will be chosen by a Resource, if this ever happen.

Thanks


Reply via email to