Hi Vincent, Exactly! This was a great thread, thanks for starting it.
Best regards, Jerome > -----Message d'origine----- > De : news [mailto:[EMAIL PROTECTED] De la part de Vincent > Envoyé : mardi 23 janvier 2007 18:25 > À : [email protected] > Objet : Re: Getting confused > > Hi Jerome, > > > Good points. You got the post method right, it could just > be simpler: > > > > post(...) { > > [..] > > ImageResource image = new ImageResource(...); > > > > > getResponse().setEntity(image.getRepresentation(image.getPrefe > rredVariant()) > > ); > > } > > I thought this wouldn't work because the image knows nothing > about the request, > so the getPreferredVariant won't know the client has > requested am image/png > variant. > But, resding your response, I realized that I it is might > just be a matter of > creating the appropriate Image constructor: > > public Image(Context, context, Request request, > Response response,<other parameters>){ > super(context,request,response); > // initialize the resource from <other parameters> > [...] > } > > In Collection.post I would then do: > > Representation post(...){ > > // Create the resource > [...] > // return a representation of the newly created resource > Image image = new Image(getContext(),getRequest(),getResponse(), > <other parameters>); > > getResponse().setEntity(image.getRepresentation(image.getPrefe > rredVariant()); > } > > > I hope we can declare that one horse dead for good... > > Thanks, > > -Vincent.

