<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=white align=center>
       <img height=40 alt="" border=0 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=white>




        <table cellpadding=0 cellspacing=0 border=0>
          
       <!--a1  Introduction manual.tmpl-->
    
            <tr><td><a href="../introduction/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../introduction/index.html"><if match="selected is "
		  ><b>Introduction</b></if
		><else>Introduction</else></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"><if match="selected is "
		  ><b>CGI and SSI</b></if
		><else>CGI and SSI</else></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"><if match="selected is "
		  ><b>&lt;pike&gt; tag</b></if
		><else>&lt;pike&gt; tag</else></a></td>
	    </tr>
    
          
       <!--a1  Pike script manual.tmpl-->
    
            <tr><td><a href="../pike-scripts/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../pike-scripts/index.html"><if match="selected is "
		  ><b>Pike script</b></if
		><else>Pike script</else></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"><if match="selected is "
		  ><b>Modules</b></if
		><else>Modules</else></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"><if match="selected is "
		  ><b>Parser modules</b></if
		><else>Parser modules</else></a></td>
	    </tr>
    
          
       <!--a1  Location modules manual.tmpl-->
    
            <tr><td><a href="index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="index.html"><if match="selected is selected"
		  ><b>Location modules</b></if
		><else>Location modules</else></a></td>
	    </tr>
    
          
	</table>
	
        <table cellpadding=0 cellspacing=0 border=0>
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="find_dir.html"><img border=0 src="../../img/page.gif"></a>&nbsp;</td>
	      <td><a href="find_dir.html"><if match="selected is "
		  ><if match="manual.tmpl is tag.tmpl"
		    ><b>&lt;find_dir()&gt;</b></if
		  ><else><b>find_dir()</b></else></if
		><else
		  ><if match="manual.tmpl is tag.tmpl"
		    >&lt;find_dir()&gt;</if
		  ><else>find_dir()</else></else></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"><if match="selected is "
		  ><if match="manual.tmpl is tag.tmpl"
		    ><b>&lt;find_file()&gt;</b></if
		  ><else><b>find_file()</b></else></if
		><else
		  ><if match="manual.tmpl is tag.tmpl"
		    >&lt;find_file()&gt;</if
		  ><else>find_file()</else></else></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"><if match="selected is "
		  ><if match="manual.tmpl is tag.tmpl"
		    ><b>&lt;query_location()&gt;</b></if
		  ><else><b>query_location()</b></else></if
		><else
		  ><if match="manual.tmpl is tag.tmpl"
		    >&lt;query_location()&gt;</if
		  ><else>query_location()</else></else></a></td>
	    </tr>
    
	  
      <!--b1  -->
    
	    <tr><td>&nbsp;&nbsp;<a href="real_file.html"><img border=0 src="../../img/page.gif"></a>&nbsp;</td>
	      <td><a href="real_file.html"><if match="selected is "
		  ><if match="manual.tmpl is tag.tmpl"
		    ><b>&lt;real_file()&gt;</b></if
		  ><else><b>real_file()</b></else></if
		><else
		  ><if match="manual.tmpl is tag.tmpl"
		    >&lt;real_file()&gt;</if
		  ><else>real_file()</else></else></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"><if match="selected is "
		  ><if match="manual.tmpl is tag.tmpl"
		    ><b>&lt;stat_file()&gt;</b></if
		  ><else><b>stat_file()</b></else></if
		><else
		  ><if match="manual.tmpl is tag.tmpl"
		    >&lt;stat_file()&gt;</if
		  ><else>stat_file()</else></else></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"><if match="selected is "
		  ><b>Other module types</b></if><else>Other module types</else></a></td>
	    </tr>
    
          
      <!--c1  -->
    
            <tr><td><a href="../id/index.html"><img border=0 src="../../img/chapter.gif"></a>&nbsp;</td>
	      <td><a href="../id/index.html"><if match="selected is "
		  ><b>Request information object</b></if><else>Request information object</else></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"><if match="selected is "
		  ><b>Responses</b></if><else>Responses</else></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"><if match="selected is "
		  ><b>Library methods</b></if><else>Library methods</else></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=white>
       <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>
