Hi Keith,

This is all set in org.restlet.service.MetadataService.

"form" is a  MediaType.APPLICATION_WWW_FORM , which explains why the 
multipart is returning a 405.
A "multipart" (MediaType.MULTIPART_FORM_DATA ) request doesn't seem to 
be in the MetadataService, so you could add your own.

 From your Application: getMetadataService().addExtension("multipart", 
MediaType.MULTIPART_FORM_DATA, true);

then you can do:

@Post("multipart")
...

Hope this helps,

Jon

On 28/09/10 02:30, Keith Irwin wrote:
>
>
> On Mon, Sep 27, 2010 at 5:03 PM, Keith Irwin <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     Folks--
>
>     Using restlets 2.1 snapshot
>
>     I have a method defined like this:
>
>       @Post("form")
>       public Representation accept(Representation r) {
>          ...
>       }
>
>     When I use the following command line to test:
>
>        curl -v -d foo=bar http://localhost:9000/my/route
>
>     everything works just fine. I'm getting a representation of type
>     application/x-www-form-urlencoded, which is what I'd expect.
>
>     However, if I do the following:
>
>       curl -v -F foo=bar http://localhost:9000/my/route
>
>     which sends the data as multipart/form-data, I get a 405, Method
>     Not Allowed response.
>
>
> When I override the post method in my ServerResource subclass and 
> print out the media type of the entity, I get the following:
>
> multipart/form-data; boundary=----------------------------e5eac570d03e
>
> rather than just plain old: "multipart/form-data", which is what I'd 
> expect based on the value of the MediaType.MULTIPART_FORM_DATA object.
>
> Not sure if this might be the problem.
>
> Keith
>
>
>     If I do NOT use the @Post("form"), no matter what I do I get the 405.
>
>     I've got the fileupload extensions installed. Is there something
>     I'm missing? What token should I include in the @Post annotation?
>      "multipartform" doesn't seem to work.
>
>     Should I downgrade to 2.0?
>
>     Keith
>
>

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

Reply via email to