Hello Mark,

I forgot to say the API has been updated only for the 2.1 trunk, not the
2.0 branch. There is still a workaround (see
http://restlet.tigris.org/issues/show_bug.cgi?id=1219). You can have a look
at the end of this mail.

>There is something I do not understand. Is it the client who has to call
ClientResource.setRe​questEntityBuffering​(true) ?
yes, all happens on client side. As GAE does not support chunked entities,
the client has to send an instance of Representation with a known size, by
doing so the client connector won't use chunked encoding.

Best regards,
Thierry Boileau
here is an excerpt of issue 1219 (
http://restlet.tigris.org/issues/show_bug.cgi?id=1219) :

A solution is to wrap the sent entity in a Representation that expand the
chunked entity, store it in memory, then calculate the size.
Or to change the behaviour of the ClientResource. It could be
something like that:
ClientResource res = new ClientResource("<remoteUri>") {
  @Override
  protected Representation toRepresentation(Object source, Variant target) {
    Representation result = null;
    if (source != null) {
      org.restlet.service.ConverterService cs = getConverterService();
      result = cs.toRepresentation(source, target, this);
      if (result != null) {
        try {
          final ByteArrayOutputStream os = new ByteArrayOutputStream();
          BioUtils.copy(result.getStream(), os);
          OutputRepresentation rep = new OutputRepresentation(
            result.getMediaType()) {
              @Override
              public void write(OutputStream outputStream) throws IOException {
                outputStream.write(os.toByteArray());
              }
            };
          rep.setSize(os.size());
          result = rep;
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  return result;
 }
};


If all your client calls are issued from an instance of
org.restlet.Application, you can use and outbound filter that copes with
this feature.

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

Reply via email to