Hi there,

Wile trying out the samples I've ran into some issues with those in
org.restlet.example.book.rest.ch7.*

When trying out the PUT of a new user I'm just getting a 200 (OK)
(I was expecting a 201 created?)

Trying to GET it afterwards yields a 500 Internal error.

Jul 24, 2007 11:40:51 AM com.noelios.restlet.StatusFilter getStatus
SEVERE: Unhandled exception or error intercepted
java.lang.NullPointerException
        at 
org.restlet.example.book.rest.ch7.UserResource.getRepresentation(UserResource.java:198)
        at org.restlet.resource.Resource.handleGet(Resource.java:473)
        at org.restlet.Finder.handle(Finder.java:292)
        at org.restlet.Filter.doHandle(Filter.java:105)
        at org.restlet.Filter.handle(Filter.java:134)

There is no representation available, as far as I can check I presume this is because the user was never created.

Some further digging made me believe the PUT never succeeds based on this test in UserResource#put

if (entity.getMediaType().equals(MediaType.APPLICATION_WWW_FORM))

apparently the MediaType used by the ApplicationTest is
  application/x-www-form-urlencoded; charset=UTF-8

which is mildly different from the test value:
  application/x-www-form-urlencoded


Changing the test to ignore media-type-parameters:

if (entity.getMediaType().equals(MediaType.APPLICATION_WWW_FORM, true))

only gets me marginally further into a IllegalBlockinModeException when the PUT now really tries to read the values that are form-encoded inside the body of the put message...

Jul 24, 2007 11:57:32 AM com.noelios.restlet.StatusFilter getStatus
SEVERE: Unhandled exception or error intercepted
java.nio.channels.IllegalBlockingModeException
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:39)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:92)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:86)
        at java.io.InputStream.read(InputStream.java:89)
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:64)
        at 
com.noelios.restlet.util.FormReader.readNextParameter(FormReader.java:231)
        at 
com.noelios.restlet.util.FormReader.addParameters(FormReader.java:308)
        at com.noelios.restlet.util.FormUtils.parsePost(FormUtils.java:92)
        at com.noelios.restlet.Engine.parse(Engine.java:822)
        at org.restlet.data.Form.<init>(Form.java:73)
        at org.restlet.data.Form.<init>(Form.java:99)
        at 
org.restlet.example.book.rest.ch7.UserResource.put(UserResource.java:252)


Any help, advise or explanation is welcome.

regards,
-marc=

Reply via email to