By the way, I love the suggestion.

Can't you add getTag() (or some method) sooner rather than later? The default implementation would simply return NULL which would then force the algorithm to call getRepresentation() just like it currently does.

There should be no consequence of this in 1.0.x code?

Just curious.

Adam


Jerome Louvel wrote:
Hi Stian,

We haven't forgotten about your suggestion, just dealing with a long email
backlog :)
It is perfectly possible to optimize the internal algorithm so that
getRepresentation(Variant) is never called when the variant's tag matches
the one provided by the client.

I've entered a RFE to keep track of it:
http://restlet.tigris.org/issues/show_bug.cgi?id=319

As it changes the observed behavior a bit, it should only go in Restlet 1.1,
IMHO.

Best regards,
Jerome
-----Message d'origine-----
De : Stian Soiland [mailto:[EMAIL PROTECTED] Envoyé : mercredi 6 juin 2007 11:23
À : [email protected]
Objet : Re: Conditional GETs?


On 4 Jun 2007, at 15:53, Peter Lacey wrote:

public Representation getRepresentation(Variant variant) {
    Representation result = null;

    if (variant.getMediaType().equals(MediaType.APPLICATION_XML)) {
        
        // create DOM
        
result = new DomRepresentation(MediaType.APPLICATION_XML, doc);
        result.setTag(new Tag([your etag], false));
    }
    return result;
}
It's really clever, except you still have to create that XML representation that never needs to be sent out.

If there was some getTag() method or something you could override this to check directly with the database on whatever you need to calculate the tag, and hence getRepresentation() wouldn't even need to be called.

To support this I think some kind of getLastModified() would also be cool. (I've made such a thing in my subclass of Resource)

--
Stian Soiland, myGrid team
School of Computer Science
The University of Manchester
http://www.cs.man.ac.uk/~ssoiland/

Reply via email to