LabVIEW Web Server

Publishing Documents

All documents that are published by the LabVIEW Web Server must be located in the server root directory. By default, the root directory is /ni-rt/system/www. You can change the root directory in the Web Server: Configuration page of the RT Target Options dialog box.

File Paths and URLs

When you save a document to the Web server root directory, you can retrieve it using a corresponding URL. A URL tells a browser what server to connect to and tells the server which document to return. URLs to documents retrieved from the LabVIEW Web Server are in the following format:

http://host.domain.com/path/to/document.htm
http://
host.domain.com:8000/path/to/document.htm

http://
This string tells the browser that it is connecting to an HTTP server.

host.domain.com
This string tells the browser the Internet address of the Web server (your computer).

:8000
This number specifies the HTTP Port used by the server. If the server uses port 80, this number can be omitted (as in the first example).

/path/to/document.htm
This string tells the Web server which document to return. It is a list of directory and filenames separated by the slash (/) character. The specified path is appended to the server's root directory. For example, if the root directory on the RT target is /ni-rt/system/www, the string /path/to/document.htm specifies the file /ni-rt/system/www/path/to/document.htm.

Converting a File Path to a URL

The URL to your document begins with http:// followed by the Internet address of your computer. If your server is using a port other than 80, follow this with a colon (:) and the port number. Finally, append the URL file path.

To determine the URL path of a file in your root directory, take the file path and ignore the part at the beginning of the path that is the same as your root directory. Change the path separator characters \ (Windows), : (Mac OS), or / (Unix) to the URL path separator character /.

Special Characters

If the converted file path contains any special characters such as spaces, special punctuation marks, or characters with accents, you must encode them according to URL conventions. Each special character should be replaced by %xx, where xx is the hexadecimal value of the character. For example, the file name "Experiment Page.htm" is encoded as "Experiment%20Page.htm" because 20 is the hexadecimal value of the space character.

Note: If you use only ASCII letters and numbers and avoid spaces in your file and directory names, you do not have to encode special characters.

Text Documents

The most common text document format on the Web is HTML. You can create HTML documents using an HTML editor. You can download shareware HTML editors from the Web. Many word processor applications, such as WordPerfect or Microsoft Word also allow you to save documents in HTML format.

When you save an HTML document, make sure that it has a .htm or .html filename extension.

Image Documents

The most common image formats on the Web are JPEG and GIF. Another more recent Web image format is PNG; however, it is not supported by older browsers. Many image editing programs allow you to save images in one of the Web image formats. You also can use utilities to convert Windows BMP files or Mac OS PICT files to a Web image file.

When you save an image file in a Web format, make sure that is has the appropriate (.gif, .jpg, .jpeg, or .png) filename extension.

Default Directory Document—index.htm

When a URL ends with a slash / (for example, http://host.domain.com/tests/), it specifies a directory rather than a file. In this case, the Web server returns the file index.htm located in the specified directory, if it exists. In other words, the server automatically appends index.htm to the URL (for example, http://host.domain.com/tests/index.htm).

It is a good idea to have an index.htm file located in your root directory so that anyone who connects to your computer using a URL such as http://host.domain.com receives a valid document.


© National Instruments