Hi Dustin,

Actually I added a trailing slash to the path and attached it to a class
which can accept a PUT request. The code is like this:

public Restlet createInboundRoot(){
        Router router = new Router(getContext());
        router.attach("/mails/{mailId}/", MailServerResource.class);

        return router;
    }

In other word, if I send a request to http://url/mails/123/, the server can
response properly. But it turned out a 404 error when I used "curl -T"
request. My curl command was like this:

curl -T test.log http://url/mails/123/

then the server returned a 404 error, and I found the following information
in my console:

   PUT    /mails/123/text.log    -    404    439    0    11

It seems that the server fails to locate text.log file, which is the file I
want to upload! So I get confused.

I tried debugging it but even didn't find anything. I doubt if I have a
hard time understanding how the PUT method works. Do you find any clue?

I think the original problem has been solved. I got that error because I
missed the trailing slash, a problem with the cURL syntax.


Thanks,
Fan


2013/7/17 Dustin Nicholas Jenkins [via Restlet Discuss] <
ml-node+s1400322n7578869...@n2.nabble.com>

> Hi Fan,
>
> Alright, then remove the trailing slash since it's not finding the
> resource anymore.
>
> What is the problem exactly?  Is the entity null?  Is the media-type
> wrong?  Have you run it through the debugger?
>
> Dustin
>
>
> On 07/16/2013 07:44 PM, Fan J wrote:
> > Hi Dustin,
> >
> > Adding an ending slash makes a difference - it complains 404 error(The
> server has not found anything matching the request URI) instead of 400
> error(Bad request). I wonder if I need to make certain changes to my code
> above. Do you have any ideas?
> >
> > Thanks,
> > Fan
>
> --
> Dustin N. Jenkins | 250-363-3101
>
>
> Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=7578869&i=0>
>
> facsimile/télécopieur: (250) 363-0045
>
> National Research Council Canada | 5071 West Saanich Rd, Victoria BC.
> V9E 2E7
>
> Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria
> (C.-B) V9E 2E7
>
> Government of Canada | Gouvernement du Canada
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3060674
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://restlet-discuss.1400322.n2.nabble.com/how-to-accept-file-upload-using-Put-annotation-tp7578862p7578869.html
>  To start a new topic under Restlet Discuss, email
> ml-node+s1400322n1400322...@n2.nabble.com
> To unsubscribe from Restlet Discuss, click 
> here<http://restlet-discuss.1400322.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1400322&code=ZGN2YW4yNEBnbWFpbC5jb218MTQwMDMyMnwtMTc0Mzg5Mzg1MQ==>
> .
> NAML<http://restlet-discuss.1400322.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Sincerely,
Fan Jiang

Master of Science in Information Science
School of Library and Information Science
University of North Carolina at Chapel Hill
(919)-360-1047




--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/how-to-accept-file-upload-using-Put-annotation-tp7578862p7578870.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Reply via email to