[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_SetUrlToFileProc

Overview

Customize relative file mapping

Syntax

    void Ns_SetUrlToFileProc(
    char *hserver,
    Ns_UrlToFileProc *proc
    );

Description

Ns_SetUrlToFileProc() sets the procedure pointed to by proc to be called by Ns_UrlToFile() to map a URL to a file pathname. The interface of the procedure pointed to by proc must have the same interface as Ns_UrlToFile().

A NULL proc argument to Ns_SetUrlToFileProc() causes Ns_UrlToFile() afterwards to call a default procedure.

Examples

    int
    Ns_ModuleInit(char *hServer, char *hModule)
    {
        Ns_SetUrlToFileProc(hServer, AliasedUrlToFile);
    
        return NS_OK;
    }
    
    static int
    AliasedUrlToFile(Ns_DString *dest, char *hServer, char *relpath)
    {
        char   *pageRoot;
    
        /*
         * construct dest from hServer and relpath 
         */
    
        pageRoot = Ns_PageRoot(hServer);
        Ns_MakePath(dest, pageRoot, relpath, NULL);
    
        return NS_OK;
    }

See the alias C example for a more comprehensive example.

See also

Ns_UrlToFile()

Ns_MakePath()

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.