FileSend

From Tomes Support Wiki

Jump to: navigation, search

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:

In Java, the transformation might look like the following:

  1.  
  2. String sSendFilename = "The filename.ext";
  3. if(Charset.forName("ASCII").newEncoder().canEncode(sSendFilename)) {
  4. sSendFilename = "=?UTF-8?B?" + Base64.encodeBytes(sSendFilename.getBytes("UTF-8")) + "?=";
  5. }
  6.  

An appropriate public domain Base64 class can be found at http://iharder.net/base64

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox