How do I upload a file (multipart form data) to a JAX-RS Restlet resource?

I tried using @Context HttpServletRequest and planning to use Apache Commons
FileUpload on that. However, simply specifying @Context HttpServletRequest
gives me:

HTTP ERROR: 405

The method specified in the request is not allowed for the resource
identified by the request URI

RequestURI=/x

*Powered by Jetty:// <http://jetty.mortbay.org/>*

My signature is:

    @POST
    @Path("{id}")
    @Produces("text/plain")
    public String postDatabase(@Context HttpServletRequest request,
            @PathParam("id") String id) {

However, removing the @Context gives me no errors

    @POST
    @Path("{id}")
    @Produces("text/plain")
    public String postDatabase(@PathParam("id") String id) {

But in this case I won't be able to do anything with the request/file
upload.

Any help / workarounds is highly appreciated.

-- 
Best regards,
Hendy Irawan
+62 81-2210-66622 :: +62 22-91853265
http://www.hendyirawan.com/ :: [email protected]

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

Reply via email to