Restlet client resource 'put' and threading

2014-07-09 Thread Frank Kolnick
I have a simple Java app that uses Restlet to send messages to a remote server. A thread running in the background has these lines of code: ClientResource resourceHB = new ClientResource ( uri ); resourceHB.put ( heartbeat ); which works fine. I.e., the message is sent to the desired

Put with no content

2014-07-11 Thread Frank Kolnick
A previous thread seems to indicate that this has been fixed, but I still get a No Content error when I send a PUT to a Restlet-based server. (The client uses a library other than Restlet.) I have the latest stable release of Restlet. Is there a work-around? Preferably not one that requires

RE: Re: Put with no content

2014-07-11 Thread Frank Kolnick
Thanks Thierry. I believe it happens specifically when the content length is set to zero (from my reading of previous posts on the subject, and from my own specific case). I have declared simply: @Put public void update(); The 'update' method is never called. I.e., the client gets the

unsupported media type

2014-07-11 Thread Frank Kolnick
I get this error when issuing a PUT to a Restlet-based server. Is there a way to tell Restlet to accept 'anything', i.e., all text-based content? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3084952

RE: Re: Put with no content

2014-07-14 Thread Frank Kolnick
I tried setting the content length to -1, as per MSDN: The ContentLength property contains the value of the Content-Length header returned with the response. If the Content-Length header is not set in the response, ContentLength is set to the value -1. Restlet now complains that the content

RE: Re: Put with no content

2014-07-14 Thread Frank Kolnick
Follow-up: It *does* get through if I can arrange to not set the content length at all. However, this requires some deviousness on the client side. I would personally much prefer if Restlet ignored a content length of zero. --

RE: unsupported media type

2014-07-14 Thread Frank Kolnick
I have tried sending (PUT) with a content-type of text/plain (verified via Fiddler). On the server side, I have tried: @Put(text/plain) @Put(text) @Put(plain) I still get the media error in all cases. What am I doing wrong? Can I tell Restlet to accept *anything*?

RE: unsupported media type

2014-07-14 Thread Frank Kolnick
Unfortunately, that does not appear to be the case. I.e., that's where I started, and was getting the error. I tried the variations in order to fix the problem, so far without success. @Put should be enough to tell Restlet to accept anything El jul 14, 2014 1:16 PM, Frank Kolnick

RE: Re: Re: Put with no content

2014-07-15 Thread Frank Kolnick
Thanks Thierry :-) -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3085213

RE: Re: unsupported media type

2014-07-15 Thread Frank Kolnick
. If that still does not work try adding the following method to that class: @Override protected void initResource() { getVariants().add(MediaType.ALL); // I never had to use this, IIRC this is */* } Good luck! On Mon, Jul 14, 2014 at 3:03 PM, Frank Kolnick reallyfrank at hotmail dot

RE: Re: unsupported media type

2014-07-15 Thread Frank Kolnick
It's fine if I call setEntity() and return something/anything. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3085219