HttpStream

Overview

Currently we are working on providing to the user a way to create streams that interact with any valid pathname, including that of any schema. This implementation of the stream class will give support to Http pathnames, which will in turn allow the user to interact with http URIs.

It should be noted that our implementation of stream support of Http will be both concrete and of our own description. First, Http streams can only originate from IO, character streams; any attempt to create anything else, such as input, should generate an error.

The open, read, and write functions are also unique for HttpStreams. The process for dealing with Http streams occur in the following order:

  • open
  • write - [optional] this acts as a request-sender, as in it can direct to another html page or directory from the base given http pathname, e.g. (write-char "/docs/index/support.html")
  • read - this acts as a request-returner, in that it returns html code of the given last write command. So from (read-line s) we would get the first line (up to a line break) of the html page.

From here the user can keep on opening more streams and continuing these steps. It should be noted that these functions must occur in this order for http streams, anything else should throw and error exception.

Example Usage

(setq s (open (pathname "http://cofc.edu")))

(open-stream-p s)

(file-write-data s)

(read-line s)

(close s)

Implementation

Methods of HttpStream

Lisp Functions Java Method Description Status
read-char readChar Returns the character at the current file position and moves the file position to the next character. Implemented
read-line readLine Returns the string at the current file position up to the next line break. Implemented
file-write-date writeDate Returns the date the file was last modified in seconds since 1900; implemented through the last-modified HTTP header. Implemented
file-length getFileLegth Returns the size of the file in octets; uses the content-length HTTP header. UNIMPLEMENTED
write-line writeLine Appends a request to the HTTP resources (as a directory/file, "/doc/index.html", or as a fragment, "#here") UNIMPLEMENTED
write-char writeChar Sends POST data to the HTTP resource. UNIMPLEMENTED

Core Java Classes Javadoc Links
URL https://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html
URLConnection http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html
BufferedReader? http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html

Discussions

Links to Blog issues

Current Status of HttpStream

Status: Implemented and working

Release Level:

Open bug count:

Test Suites

Links to JUnit results

-- JerryBoetje - 12 Jul 2003

Topic revision: r3 - 2007-12-05 - 22:24:12 - SethRylan?
 
Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback