Hello Laurent,

thanks for your reports it helps to fix a bug regarding the generation 
of chunked responses.
The fix is available in the svn repository.

Best regards,
Thierry Boileau

> Hello Thierry,
> Le 25/01/2010 17:47, Thierry Boileau a écrit :
>    
>> I send a very basic application which works fine for me with the current
>> content of the svn repository.
>>      
> Thanks for your time, I should have done the same thing. Also I should
> tell that I'm using restlet 2.0 M6
> In your small resource, you send back a string, and this is working fine
> in my environnement.
> I use your resource in my application, and it worked also. The main
> difference between our resource is that I send back a
> JSONRepresentation. And if I change your code, I have the same behavior
> (the client waits until forever the end of the response).
> Could you test with this modification ?
>
> @Post
>       public Representation testPost(Representation rep) throws
> JSONException {
>           try {
>               return new JsonRepresentation(new JSONObject().put("hello",
> "hello " + rep.getText() + "\n"));
>           } catch (Exception e) {
>               return new JsonRepresentation(new JSONObject().put("error",
> e.getMessage()));
>           }
>
>       }
>
> P.S: added a stack trace when I use ctrl+c in curl in the small
> application :
> INFO: 2010-01-26      15:07:10        127.0.0.1       -       -       8182    
> POST
> /test/resource        -       200     -       7       31      
> http://localhost:8182   curl/7.19.5
> (i386-pc-win32) libcurl/7.19.5 OpenSSL/0.9.8k zlib/1.2.3      -
> java.io.IOException: Une connexion existante a dû être fermée par l'hôte
> distant
>       at sun.nio.ch.SocketDispatcher.read0(Native Method)
>       at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
>       at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
>       at sun.nio.ch.IOUtil.read(IOUtil.java:206)
>       at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
>       at
> org.jboss.netty.buffer.HeapChannelBuffer.setBytes(HeapChannelBuffer.java:156)
>       at
> org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:425)
>       at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:305)
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275)
>       at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196)
>       at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:619)
> java.io.IOException: Une connexion existante a dû être fermée par l'hôte
> distant
>       at sun.nio.ch.SocketDispatcher.write0(Native Method)
>       at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
>       at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
>       at sun.nio.ch.IOUtil.write(IOUtil.java:75)
>       at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
>       at
> org.jboss.netty.buffer.HeapChannelBuffer.getBytes(HeapChannelBuffer.java:107)
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.writeNow(NioWorker.java:431)
>       at 
> org.jboss.netty.channel.socket.nio.NioWorker.write(NioWorker.java:357)
>       at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:137)
>       at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76)
>       at org.jboss.netty.channel.Channels.write(Channels.java:916)
>       at
> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:69)
>       at org.jboss.netty.channel.Channels.write(Channels.java:895)
>       at org.jboss.netty.channel.Channels.write(Channels.java:842)
>       at 
> org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:229)
>       at
> org.restlet.ext.netty.internal.HttpRequestHandler.sendError(HttpRequestHandler.java:225)
>       at
> org.restlet.ext.netty.internal.HttpRequestHandler.exceptionCaught(HttpRequestHandler.java:116)
>       at
> org.jboss.netty.handler.codec.replay.ReplayingDecoder.exceptionCaught(ReplayingDecoder.java:445)
>       at 
> org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:619)
>       at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:315)
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275)
>       at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196)
>       at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:619)
> java.nio.channels.ClosedChannelException
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:630)
>       at 
> org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:589)
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.writeNow(NioWorker.java:466)
>       at 
> org.jboss.netty.channel.socket.nio.NioWorker.write(NioWorker.java:357)
>       at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:137)
>       at
> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76)
>       at org.jboss.netty.channel.Channels.write(Channels.java:916)
>       at
> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:69)
>       at org.jboss.netty.channel.Channels.write(Channels.java:895)
>       at org.jboss.netty.channel.Channels.write(Channels.java:842)
>       at 
> org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:229)
>       at
> org.restlet.ext.netty.internal.HttpRequestHandler.sendError(HttpRequestHandler.java:225)
>       at
> org.restlet.ext.netty.internal.HttpRequestHandler.exceptionCaught(HttpRequestHandler.java:116)
>       at
> org.jboss.netty.handler.codec.replay.ReplayingDecoder.exceptionCaught(ReplayingDecoder.java:445)
>       at 
> org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:619)
>       at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:315)
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275)
>       at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196)
>       at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:619)
>
>    
>> Here is the console trace I get:
>>
>> thie...@thierry-laptop:~$ curl -i -X POST -H "Content-Type:
>> application/json" -d Laurent  http://localhost:8182/test/resource
>> HTTP/1.1 200 The request has succeeded
>> Accept-Ranges: bytes
>> Content-Length: 14
>> Content-Type: */*; charset=ISO-8859-1
>> Date: Mon, 25 Jan 2010 16:45:33 GMT
>> Server:
>> Restlet-Framework/@major-num...@.@minor-number@@release-type@@release-number@
>> Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
>>
>> hello Laurent
>> thie...@thierry-laptop:~$
>>
>> Could you try it?
>>
>> Best regards,
>> THierry Boileau
>>      
>
>
>

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

Reply via email to