Here is my ServerResource response implementation:

return new OutputRepresentation(mediaType) {
                        @Override
                        public void write(OutputStream outputStream) throws 
IOException {
                                byte[] buffer = new byte[1024];
                                
                                long totalLength = 0;
                                int length;
                                while ((length = inputStream.read(buffer)) > 0) 
{
                                        outputStream.write(buffer, 0, length);
                                        totalLength += length;
                                }
                                setSize(totalLength);
                        }
                };

The HTTP response does not include Content-Length. But when I construct 
OutputRepresentation to include expectedSize argument in the constructor, as 
below, the Content-Length is included in the HTTP response properly.

return new OutputRepresentation(mediaType, length) { ... }

Is this a bug or intended behavior?

Thanks!
Jakkrit Vongsraluang (PaePae)

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

Reply via email to