Any reason you didn't try the approach I suggested, of overriding
Resource.toRepresentation(Object, Variant).

On Thu, Jan 26, 2012 at 6:52 PM, Koen Maes <[email protected]> wrote:

> The final solution was to override the handle() method of ServerResource :
>
>
> @Override
> public Representation handle() {
>    Representation representation = super.handle();
>    if (ret != null) {
>        new StrongEtagCallback<Account>(ret).handle(getRequest(),
> getResponse());
>    }
>    return representation;
> }
>
>
>
> The ETAG header is now sent :
>
> HTTP/1.1 200 OK
> Content-Type: application/x-java-serialized-object+gwt; charset=UTF-8
> **ETag: "Account-104-27012012003721199"**
> Date: Thu, 26 Jan 2012 23:44:32 GMT
> Accept-Ranges: bytes
> Server: Restlet-Framework/2.1rc1
> Transfer-Encoding: chunked
> Setting a callback setOnSent is exectued after the response is committed,
> that's why this solution did not work.
>
>
> I would actually expect a similar hook or some kinda setNext() Restlet to
> do post processing. After all, StrongEtagCallback implements Uniform.
>
> IMO, this would fit much better in the overall architecture of Restlet. Or
> do I mix things up here.
>
> FYI: cross-posting on SO :
> http://stackoverflow.com/questions/9015511/setting-etag-lastmodified-on-representation-sent-by-serverresource
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2911389
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2911825

Reply via email to