Hi Josh,

Marc Portier reported a similar issue, we need to fix this before 1.1 M1:
http://restlet.tigris.org/issues/show_bug.cgi?id=341

The problem lies in the usage of the Channels.newInputStream() method which
assumes a blocking channel which is false for Grizzly connector.

If you have time debugging this, that would be appreciated. The keys are
inside the o.r.u.ByteUtils class.

Best regards,
Jerome  

> -----Message d'origine-----
> De : josh lucas [mailto:[EMAIL PROTECTED] 
> Envoyé : lundi 13 août 2007 01:30
> À : [email protected]
> Objet : POSTing to Grizzly + Restlet
> 
> Hi -
> 
> I've downloaded the recent 1.1 snapshot and I'm trying to use the  
> Grizzly connector.  Everything is working just fine for GETs but  
> POSTs are causing me some problems.
> 
> When I call Request.getEntitiyAsForm, I get the following exception:
> 
>       [java] java.nio.channels.IllegalBlockingModeException
>       [java]     at sun.nio.ch.ChannelInputStream.read 
> (ChannelInputStream.java:39)
>       [java]     at sun.nio.ch.ChannelInputStream.read 
> (ChannelInputStream.java:92)
>       [java]     at sun.nio.ch.ChannelInputStream.read 
> (ChannelInputStream.java:86)
>       [java]     at java.io.InputStream.read(InputStream.java:89)
>       [java]     at sun.nio.ch.ChannelInputStream.read 
> (ChannelInputStream.java:64)
>       [java]     at  
> com.noelios.restlet.util.FormReader.readNextParameter(FormRead
> er.java: 
> 231)
>       [java]     at com.noelios.restlet.util.FormReader.addParameters 
> (FormReader.java:308)
>       [java]     at com.noelios.restlet.util.FormUtils.parsePost 
> (FormUtils.java:92)
>       [java]     at com.noelios.restlet.Engine.parse(Engine.java:822)
>       [java]     at org.restlet.data.Form.<init>(Form.java:74)
>       [java]     at org.restlet.data.Form.<init>(Form.java:100)
>       [java]     at org.restlet.data.Message.getEntityAsForm 
> (Message.java:156)
> 
> 
>  From my reading about NIO, this is caused when something 
> tries to go  
> from blocking to non-blocking or the other way around.
> 
> Just using Request.getEntity returns a ReadableRepresentation from  
> which I can get a ReadableByteChannel.  I thought I could read that  
> into a ByteBuffer and at least see the query params.  Unfortunately,  
> I'm not able to access them.  Granted I'm probably trying to access  
> them incorrectly but I'm reading the buffer and writing it out to a  
> ByteArrayOutputStream via a WritableByteChannel.
> 
> Anyone have any thoughts or ideas?
> 
> 
> thanks,
> josh

Reply via email to