Sun Java System Web Server 7.0 Update 4 NSAPI Developer's Guide

cinfo_find() Function

The cinfo_find() function uses the MIME types information to find the type, encoding, or language based on the extensions of the Universal Resource Identifier (URI) or local file name. Use this information to send headers (rq->srvhdrs) to the client indicating the content-type, content-encoding, and content-language of the data the client will be receiving from the server.

The URI name used is everything after the last slash (/) or the whole string if no slash is found. File name extensions are not case sensitive. The name can contain multiple extensions separated by a period (.) to indicate type, encoding, or language. For example, the URI a/b/filename.jp.txt.zip represents a Japanese language, text/plain type, zip-encoded file.

Syntax

cinfo *cinfo_find(char *uri);

Returns

A pointer to a newly allocated cinfo structure if the find succeeds, or NULL if the find fails.

The cinfo structure that is allocated and returned contains pointers to the content-type, content-encoding, and content-language, if found. Each structure points to static data in the types database, or NULL if not found. Do not free these pointers. You should free the cinfo structure after using it.

Parameters

char *uri is a Universal Resource Identifier (URI) or local file name. Multiple file name extensions should be separated by periods (.).