FileSend
From Tomes Support Wiki
Contents |
FileSend
FileSend returns actual book data to the client.
Request
Accepts the server version "sv" and path "p" parameters.
http://127.0.0.1:8080/FileSend?sv=0100&p=2f53616d706c65446174612f436f6c6f725f746573742e706462
Response
The verbatim content to be written to the device for this book. The Content-Disposition header must specify the filename to use on the device:
Content-Disposition: attachment; filename=foo.html
Content may optionally be "cleansed" to improve its readability on the device.
Non-Ascii Filenames
Any filenames passed in the Content-Disposition header must comply with RFC 2183 and RFC 2184. Specifically, any non-ASCII filenames must be specially encoded.
Information about the encoding process can be found here:
- http://blogs.warwick.ac.uk/kieranshaw/entry/utf-8_internationalisation_with (java)
- http://www.codeproject.com/KB/aspnet/NonUSASCII.aspx?df=100&forumid=126856&select=1078585 (.NET)
In Java, the transformation might look like the following:
if(Charset.forName("ASCII").newEncoder().canEncode(sSendFilename)) { sSendFilename = "=?UTF-8?B?" + Base64.encodeBytes(sSendFilename.getBytes("UTF-8")) + "?="; }
An appropriate public domain Base64 class can be found at http://iharder.net/base64