Hi, my first post here, so first of all, thanks guys for working on & releasing Restlet, fine thing.
Until now i was able to solve my issues on my own, but i think this one might need to be discussed. Issue: I use the FreeMarker extension to generate representations. Unfortunately, the processing of the template (with the supplied model) is done in TemplateRepresentation.write(), which is called after Resource.getRepresentation(), and even after the response header is written in HttpServerCall.sendResponse. Specific problem: So, after creating a subclass of TemplateRepresentation and moving my error handling from Resource.getRepresentation to MyTemplateRepresentation.write(), i was faced with the issue that obviously i cannot send a Status.SERVER_ERROR_INTERNAL if the processing fails completely - i can only alter the reponse body (= the entity). Possible solution: A solution _might_ be to process the template in the constructor of MyTemplateRepresentation or in a separate method, storing the result in a StringBuffer or ByteArray, which is then copied to OutputStream in the write() method. I suspect performance would suffer, but at least we had all options for exception handling. What do you think? Did i miss some point? Is there some better way? Regards, Matthias