Error using 'put' method

110 views
Skip to first unread message

Ian McCoy

unread,
Apr 1, 2013, 11:54:31 AM4/1/13
to sardi...@googlegroups.com
Hi,

I'm using sardine on an embedded device to load files to a remote server. One of the constraints I have is memory.  I am able to upload files using the put method, which takes a byte[], but some of the files I need to upload exceed my memory.  It would be really helpful to get put method, which takes a InputStream, working. 

When I call this method (Here is my call..... sardine.put(String URL, InputStream is), I get the following error:

Exception in thread "main" com.googlecode.sardine.impl.SardineException: Unexpected response (411 Length Required)
    at com.googlecode.sardine.impl.handler.ValidatingResponseHandler.validateResponse(ValidatingResponseHandler.java:49)
    at com.googlecode.sardine.impl.handler.VoidResponseHandler.handleResponse(VoidResponseHandler.java:35)
    at com.googlecode.sardine.impl.handler.VoidResponseHandler.handleResponse(VoidResponseHandler.java:30)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:945)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
    at com.googlecode.sardine.impl.SardineImpl.execute(SardineImpl.java:691)
    at com.googlecode.sardine.impl.SardineImpl.put(SardineImpl.java:602)
    at com.googlecode.sardine.impl.SardineImpl.put(SardineImpl.java:579)
    at com.googlecode.sardine.impl.SardineImpl.put(SardineImpl.java:546)
    at com.googlecode.sardine.impl.SardineImpl.put(SardineImpl.java:535)
    at com.googlecode.sardine.impl.SardineImpl.put(SardineImpl.java:526)
    at webdavtest.WebDavTest.main(WebDavTest.java:143)
Java Result: 1

Any help troubleshooting the error would be appreciated.

Regards,

Ian

Jon Stevens

unread,
Apr 1, 2013, 12:33:59 PM4/1/13
to sardi...@googlegroups.com
It appears that your server requires the Content-Length header. I'm thinking that you'll either disable that check on the server or set the header before sending the data. There is variations of the put() method that allow you to set headers.

jon




--
You received this message because you are subscribed to the Google Groups "sardine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sardine-dav...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages