Delivering X3D Content

  • warning: Parameter 1 to theme_field() expected to be a reference, value given in /home/e3d/public_html/includes/theme.inc on line 171.
  • warning: Parameter 1 to theme_field() expected to be a reference, value given in /home/e3d/public_html/includes/theme.inc on line 171.
  • warning: Parameter 1 to theme_field() expected to be a reference, value given in /home/e3d/public_html/includes/theme.inc on line 171.
  • warning: Parameter 1 to theme_field() expected to be a reference, value given in /home/e3d/public_html/includes/theme.inc on line 171.
  • warning: Parameter 1 to theme_field() expected to be a reference, value given in /home/e3d/public_html/includes/theme.inc on line 171.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/e3d/public_html/includes/file.inc on line 649.
Stumble Upon Del.icio.us Digg It Technorati reddit

Subtitle

How to Make Your Web Server Send X3D Content

Web servers need to have some understanding of the content they are sending to clients. The understanding is necessary to inform the client of the content type so that the client can correctly handle the received file. For example, browsers handle HTML differently from JPEG and plain text.

The web server sends the information to the client using a Multipurpose Internet Mail Extension (MIME) type. These types are text strings that identify the type of the files content being transmitted. This is done so the client does not need to "sniff" or examine the beginning of the file to determine the content.

MIME types work in conjunction with content encodings, or the format that is used for transmission of the data. The most common encoding is plain text. Other frequently used encodings are Base-64 and gzip. It is important to distinbuish between the file's MIME type and it's encoding. The MIME type reflects content of the file, while the encoding reflects how this particular content is stored (or transmitted).

Web servers are pre-configured to support a large variety of MIME types. The relationships are established in a variety of different manners. Apache uses a file mime.types to define all of the standard MIME types. Additional MIME types can be added to the configuration in the httpd.conf file (or any file it Includes).

The X3D specifications defines MIME types and content encodings for all of the encodings. Since X3D files are relatively new the World Wide Web. The MIME types necessary for them are frequently not included in the standard definitions. This tip discusses how to expand your web server capabilities to support X3D files. It describes the means to add X3D types to your server for just your files or for the whole server.

There are several web servers available. The most popular (based on number of sites) server is Apache. The details of this discussion will focus on the Apache server; however, the concepts apply to most all servers.

Apache uses the file mime.types to define the base set of MIME types. The file is derived from information kept at the Internet Assigned Numbers Authority. This file should not be modified. Obviously if your account is part of a large virtual server system, then you probably do not have permission to modify this file. The Apache Group recommends that you use the directive "AddType" to define additional MIME types. This directive can be placed in the primary configuration file (httpd.conf) or in your local configuration file.

If you do not control the web server, then you will need to use the local configuration file method. This method uses a file contained in any directory that is accessible from your web server. The file is typically called .htaccess. Some web servers have changed the name of this file. You will need to check with your system administrator to get the exact file name. Most systems allow you to add and use .htaccess file. You will need to check with your system administrator to confim this. The rest of this discussion assumes that the file is called .htaccess, and the web server supports its use.

The directives necessary to define the additional X3D MIME types. The format for the directive is

  AddType MIME-type extension [extension] ...

X3D encodings support a gzip content encoding. This is done with the AddEncoding directive. The format for this directive is:

  AddEncoding MIME-encoding extension [extension] ...

There are several MIME types and encodings that are needed for X3D. The complete list of directives are:

AddType model/x3d+xml .x3d
AddType model/x3d+vrml .x3dv
AddType model/x3d+binary .x3db
AddEncoding x-gzip .x3dz .x3dvz

These directives define the MIME-types and encodings for all X3D specifications (XML, Classic VRML, and Binary). These directives need to go into a .htaccess or the httpd.conf file.

The Apache web server looks for the .htaccess file starting in the current directly of the requested file. The server then searches every parent directory until the web document root (DOCUMENT_ROOT) directory. In general the result is the union of all of the directives contained in the various .htaccess files. If you have a single directory or directory limb that contains all of your X3D files than you should put the .htacecss file in that directory. Otherwise, put the .htaccess file into your web document root directory. If you already have a .htaccess file in the target directory, these directives need to be appended to the existing file.

To create your new .htacess file, open a text editor (e.g., PFE32, NotePad, etc.). Copy the above four lines and paste them into the text editor. If you have an existing .htaccess file, the above directives should be added to the end of the existing file. Save the file and upload it to your web server in the desired directory. Your web server will now use these directives when serving any file from the target directory tree.

If you have access to the web server, you can add these directives to the httpd.conf file. The default location is near the end of "Section 2: 'Main' server configuration" section. There are other "AddType" directives there. The format of the directives is the same as for the .htaccess file. It is also Modifications to the httpd.conf file require restarting of the web server for the changes to take effect.

Once the changes have be made you can verify that the changes are correct. You will need to upload the following simple X3D files to the target directory. This will verify XML and Classic VRML MIME types.

Classic VRML – verifyMime.x3dv

#X3D V3.0 utf8
PROFILE Immersive
Group {}


XML – verifyMime.x3d
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile="Immersive"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:noNamespaceSchemaLocation=
"http://www.web3d.org/specifications/x3d-3.0.xsd">
<Scene> 
  <Group/> 
</Scene>
</X3D>

Once these are uploaded, you will need to telnet to the web server on port 80. This simulates a simple web client. These files have been uploaded to http://realism.com/x3D/examples/MIME-types/.

telnet realism.com 80
GET /Web3D/Examples/MIME-types/verifyMime.x3dv HTTP/1.0

The first line is the telnet command to the server. The second line requests the verifyMime.x3dv file. The third line is blank. The blank line indicates the end of the request. The response (for this server) is:

HTTP/1.1 200 OK
Date: Fri, 22 Jul 2005 17:25:52 GMT
Server: Apache/1.3.27 (Unix) FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6g
Last-Modified: Fri, 22 Jul 2005 17:25:23 GMT
ETag: "3764ad-2f-42e12c03"
Accept-Ranges: bytes
Content-Length: 47
Connection: close
Content-Type: model/x3d+vrml
#X3D V3.0 utf8
PROFILE Immersive
Group {}
Connection to host lost.

Note the line that starts "Content-Type". This shows that the correct MIME type is being sent with this file.

A similar response will be generated for the XML encoded file:

telnet realism.com 80
GET /Web3D/Examples/MIME-types/verifyMime.x3d HTTP/1.0
HTTP/1.1 200 OK
Date: Fri, 22 Jul 2005 17:28:35 GMT
Server: Apache/1.3.27 (Unix) FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6g
Last-Modified: Fri, 22 Jul 2005 17:25:22 GMT
ETag: "3764ac-178-42e12c02"
Accept-Ranges: bytes
Content-Length: 376
Connection: close
Content-Type: model/x3d+xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile="Immersive"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:noNamespaceSchemaLocation=
"http://www.web3d.org/specifications/x3d-3.0.xsd">
<Scene>
<Group/>
  </Scene>
</X3D>
Connection to host lost.

If you do not get these results, carefully check your .htaccess or httpd.conf file. If you are using .htacess, make sure it is in the same directory as the X3D file(s) or one of its parent directories.

Last Updated (Friday, 24 July 2009 08:53)
 

Syndicate

Syndicate content

About the Author

Advertisments