<html>
<head>
<title>Location modules</title>
<meta name="keywords" content="">
</head>

<body bgcolor=#113377 text=#000000 vlink=#551a8b alink=#00c0ff link=#0000ee>




















































<table width=100% border=0>
<tr>
  <td valign=top>
  <table width=100% cellpadding=5 cellspacing=0 border=0>
    <tr><td bgcolor="#ffffff" align=center>
       <img border=0 alt="" height=40 src="../../img/logga.gif" width=102>
    </td></tr>
    <tr><td valign=top>
      <img src=internal-roxen-unit width=1 height=3 alt="">
    </td></tr>
    <tr valign=top>
      <td bgcolor="#ffffff">




        <table cellpadding=0 cellspacing=0 border=0>
          
       <!--a1  Introduction manual.tmpl-->
    
            <tr><td><a href="../introduction/index.html"><img src="../../img/chapter.gif" border=0></a>&nbsp;</td>
	      <td><a href="../introduction/index.html">Introduction</a></td>
	    </tr>
    
          
       <!--a1  CGI and SSI manual.tmpl-->
    
            <tr><td><a href="../cgi/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../cgi/index.html">CGI and SSI</a></td>
	    </tr>
    
          
       <!--a1  &lt;pike&gt; tag manual.tmpl-->
    
            <tr><td><a href="../pike-tag/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../pike-tag/index.html">&lt;pike&gt; tag</a></td>
	    </tr>
    
          
       <!--a1  Pike script manual.tmpl-->
    
            <tr><td><a href="../pike-scripts/index.html"><img src="../../img/chapter.gif" border=0></a>&nbsp;</td>
	      <td><a href="../pike-scripts/index.html">Pike script</a></td>
	    </tr>
    
          
       <!--a1  Modules manual.tmpl-->
    
            <tr><td><a href="../modules/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../modules/index.html">Modules</a></td>
	    </tr>
    
          
       <!--a1  Parser modules manual.tmpl-->
    
            <tr><td><a href="../tag-modules/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../tag-modules/index.html">Parser modules</a></td>
	    </tr>
    
          
       <!--a1  Location modules manual.tmpl-->
    
            <tr><td><a href="index.html"><img src="../../img/chapter.gif" border=0></a>&nbsp;</td>
	      <td><a href="index.html"><b>Location modules</b></a></td>
	    </tr>
    
          
	</table>
	
        <table cellpadding=0 cellspacing=0 border=0>
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="find_dir.html"><img src="../../img/page.gif" border=0></a>&nbsp;</td>
	      <td><a href="find_dir.html">find_dir()</a></td>
	    </tr>
    
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="find_file.html"><img border=0 src="../../img/page.gif"></a>&nbsp;</td>
	      <td><a href="find_file.html">find_file()</a></td>
	    </tr>
    
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="query_location.html"><img border=0 src="../../img/page.gif"></a>&nbsp;</td>
	      <td><a href="query_location.html">query_location()</a></td>
	    </tr>
    
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="real_file.html"><img src="../../img/page.gif" border=0></a>&nbsp;</td>
	      <td><a href="real_file.html">real_file()</a></td>
	    </tr>
    
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="stat_file.html"><img border=0 src="../../img/page.gif"></a>&nbsp;</td>
	      <td><a href="stat_file.html">stat_file()</a></td>
	    </tr>
    
	  
        </table>

        <table cellpadding=0 cellspacing=0 border=0>
          
      <!--c1  -->
    
            <tr><td><a href="../other-modules/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../other-modules/index.html">Other module types</a></td>
	    </tr>
    
          
      <!--c1  -->
    
            <tr><td><a href="../id/index.html"><img src="../../img/chapter.gif" border=0></a>&nbsp;</td>
	      <td><a href="../id/index.html">Request information object</a></td>
	    </tr>
    
          
      <!--c1  -->
    
            <tr><td><a href="../responses/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../responses/index.html">Responses</a></td>
	    </tr>
    
          
      <!--c1  -->
    
            <tr><td><a href="../library-methods/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../library-methods/index.html">Library methods</a></td>
	    </tr>
    
          
	</table>

      </td>
    </tr>
    <tr><td height=100%>&nbsp;</td></tr>
  </table>
  </td>
  <td>
    <img src=internal-roxen-unit width=3 height=1 alt="">
  </td>

  <td valign=top>
    <table cellspacing=0 cellpadding=5 width=100% height=100% border=0>
    <tr>
      <td bgcolor="#ffffff">
       <b><font size=+2>Location modules</font></b>

	<p>Location modules handle a mountpoint in Challengers virtual file
system. Request to a URL under a modules mountpoint will be sent to
that module. Unless there are more location modules with overlapping
mountpoints, in which case the module with the longest mountpoint will
be tried first. So if there are one module mounted on <tt>/test/</tt>
and another on <tt>/</tt> the module mounted on <tt>/test/</tt> will
be tried first. If it returns that it could not handle the request the
module mounted on <tt>/</tt> will be tried.

<p>Location modules are either Pike or CGI scripts written as modules
or file systems. For script like modules it will only be necessary to
implement the <tt>find_file()</tt> method. The advantages of
writing scripts as modules is that they can be configured and
installed nicely.

<p>Location modules that implement file systems need to implement all
API methods. This is to make it possible to interact fully with other
module types, like directory modules. File system modules usually
either give access to the normal file system, but do some special
processing or access control, or give access to files stored somewhere
else, for example in a CVS repository. For the first type of file
system modules it can be a good idea to inherit the
<i>Filesystem</i> module.

<p>The module type for the Location Modules is <tt>MODULE_LOCATION</tt>.


<p><a name="API methods">
<b><font size=+2>API methods</font></b></a>
<br>

<dl>

<dt><b>find_dir()</b><dd>



returns a directory listing. It is used indirectly by directory type
modules to create directory listings.

<p>
<dt><b>find_file()</b><dd>



is the fundamental method of all location modules. It will be called
to handle all accesses to the modules mount point.

<p>
<dt><b>query_location()</b><dd>



returns the mountpoint of the module. It can be omitted if the module
has a configuration variable <i>location</i>.

<p>
<dt><b>real_file()</b><dd>



returns the path to a file in the real file system. It can of course
only be implemented if the file in question exists in the real file
system. 

<p>
<dt><b>stat_file()</b><dd>



returns information about a file, in the same format as Pike's
<tt>file_stat()</tt> method.
</dl>

      </td>
    </tr>
    </table>
  </td>
</tr>
<tr>
</table>
</body>
</html>
