Previous chapter

Chapter 6

Chapter 6

A Prototype Digiment Browser

A Prototype Digiment Browser

This chapter describes a browser that is able to read digiments and turn them into a form that is able to be viewed by any WWW capable browser.

6.1 Basic Requirements for a Browser

Any digiment browser must have several basic requirements. Any browser that wants to display digiments in a useful way should implement these features. Although some are more important than others, these are the features that make use of the extended information available in a digiment.

6.1.1 A browser must understand the digiment format

Any browser must be able to parse the digiment format. This means being able to interpret the six application/digiment types defined in this document and extract the relevant information from them.

6.1.2 A browser should be able to use helper applications

A browser does not need to know how to use or display every possible format that may be contained within a digiment; this would be nearly impossible, as a digiment can contain data in arbitrary formats. However, it should be able to recognize the MIME type of a data object and pass the object to a user assignable application that does know how to display that data type. This is much like how most WWW browsers work today.

6.1.3 A browser should understand relationships between parts

A browser should be able to understand the relationships between parts. This means that it must be able to keep track of Content-IDs and VSNs which one part of a digiment uses to refer to another. In addition, it must be able to resolve those relationships, such as knowing which pages are substitutable for the same page in another format.

6.1.4 A browser should show relevant bibliographic material and meta-information

A browser should show appropriate bibliographic material to the user. This may include the copyright, title, and abstract. In addition, the browser should be able to show meta-information about the document, such as page numbers, page descriptions, processing comments, etc.

6.1.5 A browser should let you select between different formats

If a digiment has data objects that are in multiple formats, the browser may choose a default type to use for browsing. However, it should be able to let the user choose between all available versions at any time.

6.1.6 A browser should let you choose which page to view

A browser that is browsing a page-list should allow the user to choose from any page in the page list and go to it directly.

6.1.7 A browser should let you browse a document in the correct order

A browser should be able to understand the intended order of page-list, body-list and preferred-order parts. It should then be able to provide previous and next buttons to allow the user to browse the document in the correct order.

6.2 Creating a WWW Based Browser

The browser that I created to view digiments does not display the digiment directly. Instead, it is simply a program that reads in a digiment and creates HTML documents that can be viewed with any WWW browser. There are several advantages to this scheme, as well as several drawbacks, however.

6.2.1 Advantages to using a WWW based browser

There are two primary advantages to using a WWW based browser. The first is that by using the WWW browser as the display engine, I do not have to write another front end. Netscape and Mosaic can both handle GIF images in-line, and Netscape can also display JPEG images in-line. In addition, both can display formatted text via HTML. Furthermore, they can also display buttons and text entry fields, also via HTML. This frees the browser from having to include code for displaying text, images and user interface objects.

Secondly, the browser can be used on any platform that has a WWW browser ported to it. This includes almost every type of workstation and PC used in the world. Since the actual browser code does not have to run on the machine that the user is using, the only program the user has to run locally is a WWW browser. This enables a much wider audience than if the browser had been written for a single platform.

Another advantage is that the browser itself can run on any machine with a HTTP server. In fact, the browser code itself currently runs on the same server that the documents are stored on.

6.2.2 Disadvantages to using a WWW based browser

There are a few disadvantages to using a WWW based browser, however. One of the biggest is the lack of control over the interface. Most browsers are only able to in-line GIF images. In addition, HTML does not allow for the automatic loading of non-in-line data types. This means that anything that the browser cannot display internally, such as TIFF images, Postscript files or audio clips cannot automatically be displayed with the rest of the page. Thus, the browser can only present a page with another button for the user to click in order to actually view the data.

6.3 How the browser works

CGI, or Common Gateway Interface, is a standard for interfacing external programs with HTTP and other information servers. The browser itself is actually a CGI program that is invoked by passing a special URL to the server that is running the browser. This URL contains all the arguments necessary for the browser to determine its current state and what the user has requested. The browser interprets this URL, generates the correct HTML document that displays the requested information, and returns that to the client browser to display.

6.3.1 How to access the browser via URL

The browser is invoked by passing URLs to the server that runs it. These URLs use the CGI convention for passing parameters to a program. The way to do this is to embed a "?" in the URL; everything after that is interpreted as parameters to the program being run. The parameters take the form of "parameter=value" and are separated from each other by a "+" sign. It is valid for a parameter to not have a value. Thus, a sample call to a CGI program would look like this:

http://server/path/program?param1=foo+param2=+param3=100
Where server is the name of the server, path is the path to the CGI program and program is the name of the CGI program itself. Following the "?" are three parameters; param1, param2, and param3 with values of foo, the empty string, and 100, respectively. When the server receives a URL of this form, it calls the program with the parameter string following the "?". A URL of this form can either be constructed by another program, that knows how to form CGI style URLs, or it can be generated by a browser that knows how to use HTML forms.

The browser described in this document takes six different parameters to specify the what state the browser should be in. Since the browser is executed from the beginning each time the user access it, it has no way of keeping track of the user's current state other than embedding this information in the URL. Once the user has initially accessed the browser via the standard entry point, any URL generated by the browser for the user to use to navigate will contain values for these parameters that allow the browser to determine what its current state should be. A summary of these parameters can be found in Table 6.1 on page 64.(1)

The first parameter is getmethod. This parameter is used to determine where to obtain the digiment being browsed, and can have one of three different values; id, url, or local. If the value is id, then the browser uses a RFC1357 style id to obtain a digiment from a Dienst server. If the value is url, the browser uses an arbitrary url to obtain a digiment. If the value is local, the browser obtains the digiment from a local cache.

The second parameter is id. This parameter contains the RFC1357 style id that is used to obtain a digiment if the getmethod parameter is set to id.

The next parameter is url. This parameter contains a url that will return a valid digiment when referenced. This value is used when getmethod is set to url.

The fourth parameter is pid. This is a local reference number used when caching digiments that have already been obtained via one of the other methods. This value is used when getmethod is set to local.

The fifth parameter is vsn. Its value is the VSN of the digiment part that the user wishes to view.

The final parameter is cid. This parameter contains the Content-ID of the current digiment part that is being browsed. This part can be either a part-list, a body-list or a preferred-order. The combination of this and the vsn parameter can uniquely identify the data object that is being requested.

Table 6.1:  Parameters to the digiment browser
-------------------------------------------------
URL parameter  Parameter meaning                   
-------------------------------------------------
getmethod      Which method to use to obtain       
               digiment                            
id             ID of the digiment                  
url            URL of the digiment                 
pid            Reference ID for local caching of   
               digiment                            
vsn            VSN requested                       
cid            Content-ID of part being browsed    
                                                   
-------------------------------------------------

6.3.2 Obtaining a digiment and local caching

A digiment is obtained by the browser in one of three ways. If getmethod is set to id, the browser contacts the Dienst server that serves the document and requests the document in digiment form. If getmethod is set to url, the browser resolves the url, which is expected to return a digiment. Finally, if getmethod is set to local, the browser attempts to read the digiment from a local cache.

Whenever the browser obtains a digiment from an ID or URL, it also caches the digiment locally in the /tmp directory with a name based on its current process ID, or pid. This pid is the same value used in the pid parameter in the URL. When the browser is called with getmethod set to local, it looks at the pid parameter and checks the /tmp directory to see if the digiment corresponding to that pid is cached there. If it is, it reads the digiment from the cached file. If not, the browser resorts back to the id and url methods respectively. This can improve performance significantly since the digiments are created on the fly. This means that every call to the browser would result in a digiment being created again if the browser requested the digiment from the server each time. By caching the digiment locally, the browser can eliminate this overhead.

6.4 Parsing the Digiment

Once the browser has obtained a digiment, it parses it and looks at the parameters to determine what to display.

First the browser checks that the data it has obtained is a digiment with a valid MIME Content-Type field of multipart/digiment. If not, the browser returns an error. Otherwise, the browser extracts the boundary parameter from the multipart/digiment identifier.

Next, the browser splits the multipart/digiment into its component application/digiments by using the boundary string that it previously extracted. Each of these digiment parts is then placed into an associative array, keyed by its Content-ID. This allows the browser to look up any digiment part based on its Content-ID.

The browser then parses the bibliography part. This basically involves looking for the tags for the title, date of publication, organization, notes, abstract, and authors, and extracting the data from each field. This data is then stored in global variables so all parts of the program can access them for display purposes.

The browser also parses the part-list. This involves scanning each line of the part-list and extracting the digiment-type and content-ID from it. The content-IDs for each part-list are stored in an array, as are the content-IDs for each body-list and for each preferred-order. This allows the browser to quickly access each of the part-lists, body-lists or preferred-orders for a digiment.

6.5 Displaying the Digiment

Depending on the state of the browser, it will display one of two types of interfaces. If browser parameters do not specify a specific VSN to view, which is the default when first accessing the browser for a specific document, the browser will display the digiment summary screen. If the parameters specify a VSN, then the browser displays the page or body object associated with that VSN and the content-ID from the parameter list.

6.5.1 Displaying the summary screen

The summary screen is the main entry point to the browser. This screen shows the bibliography information that was extracted from the digiment. This consists of the document's title, its authors, the publishing organization, the abstract, and the contents of the notes field.

The browser then displays a list of options for the user to choose from. First, it will display any preferred-order parts that exist, instructing the user that these are the preferred ways to browse the document. Then it will display any body-list parts that exist, and finally it will display any page-list parts.

Each of these parts is actually a hypertext URL that encodes the correct parameters to instruct the browser to display the correct digiment part. This is done by setting the cid parameter to the content-ID of the part that the user selected, and the vsn parameter to the first VSN in the part.

One exception to this is with page-lists. In this case, the vsn parameter is not set to the first VSN in the list, but actually is set by looking at the page-map associated with that page-list and selecting the VSN of the first page that is not of type "supporting". This allows the user to skip over the supporting pages, which are usually not of interest.

6.5.2 Displaying part of the digiment

If the vsn parameter contains a value, the browser displays the data object that is referenced by the combination of the content-ID from the cid parameter and the VSN from the vsn parameter.

The browser first displays a row of buttons that allow the user to navigate through the digiment. The first four buttons will take the user to the title page (or first page if there is no title page), the previous page, the next page, and the last page, respectively. If the browser is displaying data from a body-list instead of a page-list, then it refers to sections instead of pages. The next button takes the user back to the summary page. The browser then displays a pop-up list that allows the user to select any page or section available. The browser also displays the name of the current page, and its page or body description.

Once again, the buttons actually represent URLs that encode the VSN of the correct page or body section to display. In the case of page-list types, any page that is labeled as a supporting page in the page map is excluded from the title, previous, next, and last buttons. However, these pages can be viewed by using the pop-up menu to go to them directly.

If the type of data being displayed is a GIF image, the browser inserts the image into the HTML document, where it will be displayed by the WWW browser. Any other data type cannot be displayed directly, however. In this case, the browser generates a button that the user can click on to load the specified image or body section.

Finally, the browser generates another set of buttons below the image or link that are identical to those at the top of the page. This is useful when the user is viewing images that require him to scroll to the bottom of the page.

6.6 Limitations of the Current Browser

The current version of the digiment browser has some limitations, which we hope can be fixed in a later revision. Some of these limitations are inherent to using the WWW as an interface for the browser, however. The most notable of these limitations in the inability to create complete pages for any type of data other than text or GIF images. Any other type of image or data, such as Postscript, must be loaded by a separate action by the user. This is a limitation of the current HTML 2.0 specification and/or the currently available WWW browsers, depending on your point of view.

The browser also does not support preferred-order digiment parts, although it would not be difficult to modify it to do so. The browser also does not do extended error checking and recovery, which would be a essential if the browser were to be used in a service environment.


Footnotes

(1)
There is actually another parameter, debug, which turns on debugging when set. This parameter is only designed to be used for testing purposes, and is not available from the standard interface.

Next chapter