<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>1997</year><year>2016</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</legalnotice>
<title>mod_alias</title>
<prepared>Joakim Grebenö</prepared>
<docno></docno>
<date>1997-10-14</date>
<rev>2.2</rev>
<file>mod_alias.sgml</file>
</header>
<module>mod_alias</module>
<modulesummary>URL aliasing.</modulesummary>
<description>
<p>Erlang web server internal API for handling of, for example,
interaction data exported by module <c>mod_alias</c>.</p>
<marker id="default_index"></marker>
</description>
<funcs>
<func>
<name>default_index(ConfigDB, Path) -> NewPath</name>
<fsummary>Returns a new path with the default resource or file appended.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>Path = NewPath = string()</v>
</type>
<desc>
<marker id="default_index"></marker>
<p>If <c>Path</c> is a directory, <c>default_index/2</c>, it starts
searching for resources or files that are specified in the config
directive <c>DirectoryIndex</c>.
If an appropriate resource or file is found, it is appended to
the end of <c>Path</c> and then returned. <c>Path</c> is
returned unaltered if no appropriate
file is found or if <c>Path</c> is not a directory.
<c>config_db()</c> is the server config file in ETS table format
as described in
<seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="path"></marker>
</desc>
</func>
<func>
<name>path(PathData, ConfigDB, RequestURI) -> Path</name>
<fsummary>Returns the file path to a URL.</fsummary>
<type>
<v>PathData = interaction_data()</v>
<v>ConfigDB = config_db()</v>
<v>RequestURI = Path = string()</v>
</type>
<desc>
<marker id="path"></marker>
<p><c>path/3</c> returns the file <c>Path</c> in the
<c>RequestURI</c> (see
<url href="http://www.rfc-base.org/rfc-1945.html">RFC 1945</url>).
If the interaction data <c>{real_name,{Path,AfterPath}}</c>
has been exported by <c>mod_alias</c>,
<c>Path</c> is returned. If no interaction data has been
exported, <c>ServerRoot</c> is used to
generate a file <c>Path</c>. <c>config_db()</c> and
<c>interaction_data()</c> are as defined in
<seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="real_name"></marker>
</desc>
</func>
<func>
<name>real_name(ConfigDB, RequestURI, Aliases) -> Ret</name>
<fsummary>Expands a request URI using <c>Aliases</c> config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
<v>Aliases = [{FakeName,RealName}]</v>
<v>Ret = {ShortPath,Path,AfterPath}</v>
<v>ShortPath = Path = AfterPath = string()</v>
</type>
<desc>
<marker id="real_name"></marker>
<p><c>real_name/3</c> traverses <c>Aliases</c>, typically
extracted from <c>ConfigDB</c>, and matches each
<c>FakeName</c> with <c>RequestURI</c>. If a match is found,
<c>FakeName</c> is replaced with <c>RealName</c> in the
match. The resulting path is split into two parts,
<c>ShortPath</c> and <c>AfterPath</c>, as defined in
<seealso marker="httpd_util#split_path-1">httpd_util:split_path/1</seealso>.
<c>Path</c> is generated from <c>ShortPath</c>, that is,
the result from
<seealso marker="#default_index">default_index/2</seealso> with
<c>ShortPath</c> as an argument.
<c>config_db()</c> is the server config file in ETS table
format as described in
<seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="real_script_name"></marker>
</desc>
</func>
<func>
<name>real_script_name(ConfigDB, RequestURI, ScriptAliases) -> Ret</name>
<fsummary>Expands a request URI using <c>ScriptAliases</c>
config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
<v>ScriptAliases = [{FakeName,RealName}]</v>
<v>Ret = {ShortPath,AfterPath} | not_a_script</v>
<v>ShortPath = AfterPath = string()</v>
</type>
<desc>
<marker id="real_script_name"></marker>
<p><c>real_script_name/3</c> traverses <c>ScriptAliases</c>,
typically extracted from <c>ConfigDB</c>, and matches each
<c>FakeName</c> with <c>RequestURI</c>. If a match is found,
<c>FakeName</c> is replaced with <c>RealName</c> in the
match. If the resulting match is not an executable script,
<c>not_a_script</c> is returned. If it is a script, the
resulting script path is in two parts,
<c>ShortPath</c> and <c>AfterPath</c>, as defined in
<seealso marker="httpd_util#split_script_path-1">httpd_util:split_script_path/1</seealso>.
<c>config_db()</c> is the server config file in ETS table
format as described in
<seealso marker="http_server">Inets User's Guide</seealso>.</p>
</desc>
</func>
</funcs>
</erlref>