Sun Java System Web Server 6.1 SP6 NSAPI Programmer's Guide


The cinfo_find() function uses the MIME types information to find the type, encoding, and/or language based on the extension(s) of the 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 it will be receiving from the server.

The 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 may contain multiple extensions separated by period (.) to indicate type, encoding, or language. For example, the URI a/b/ could represent a Japanese language, text/plain type, zip encoded file.


cinfo *cinfo_find(char *uri);


A pointer to a newly allocated cinfo structure if content info was found, or NULL if no content was found.

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


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