WebStack

Annotated docs/paths.html

357:b086884cf017
2005-04-26 paulb [project @ 2005-04-26 18:33:06 by paulb] Improved URL and path documentation, adding new documents to make the material more readable.
paulb@357 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
paulb@328 2
<html xmlns="http://www.w3.org/1999/xhtml">
paulb@327 3
<head>
paulb@327 4
  <title>URLs and Paths</title>
paulb@357 5
  <meta name="generator"
paulb@357 6
 content="amaya 8.1a, see http://www.w3.org/Amaya/" />
paulb@328 7
  <link href="styles.css" rel="stylesheet" type="text/css" />
paulb@327 8
</head>
paulb@327 9
<body>
paulb@327 10
<h1>URLs and Paths</h1>
paulb@357 11
<p>The URL at which your application shall appear is arguably the first
paulb@357 12
part
paulb@357 13
of the application's user interface that any user will see. Remember
paulb@357 14
that a user of your application does not have to be a real person; in
paulb@357 15
fact,
paulb@327 16
a user can be any of the following things:</p>
paulb@327 17
<ul>
paulb@327 18
  <li>A real person entering the URL into a browser's address bar.</li>
paulb@327 19
  <li>A real person linking to your application by writing the URL in a
paulb@357 20
separate Web page.</li>
paulb@357 21
  <li>A program which has the URL defined within it and which may
paulb@357 22
manipulate the URL to perform certain kinds of operations.</li>
paulb@327 23
</ul>
paulb@357 24
<p>Some application developers have a fairly rigid view of what kind of
paulb@357 25
information a URL should contain and how it should be structured. In
paulb@357 26
this guide, we shall look at a number of different approaches.</p>
paulb@327 27
<h2>Interpreting Path Information</h2>
paulb@357 28
<p>What the URL is supposed to do is to say where (on the Internet or
paulb@357 29
on an
paulb@357 30
intranet) your application resides and which resource or service is
paulb@357 31
being
paulb@327 32
accessed, and these look like this:</p>
paulb@327 33
<pre>http://www.boddie.org.uk/python/WebStack.html</pre>
paulb@357 34
<p>In an application the full URL, containing the address of the
paulb@357 35
machine on which it is running, is not always interesting. In the
paulb@357 36
WebStack API (and in other Web programming frameworks), we also talk
paulb@357 37
about "paths" - a path is&nbsp;just the part of the
paulb@357 38
URL which refers to the resource or service, ignoring the actual
paulb@357 39
Internet
paulb@357 40
address, and so the above example would have a path which looks like
paulb@357 41
this:</p>
paulb@327 42
<pre>/python/WebStack.html</pre>
paulb@327 43
<p>When writing a Web application, most of the time you just need to
paulb@357 44
concentrate on the path because the address doesn't usually tell you
paulb@357 45
anything
paulb@327 46
you don't already know. What you need to do is to interpret the path
paulb@357 47
specified in the request in order to work out which resource or service
paulb@357 48
the user is trying to access.</p>
paulb@327 49
<div class="WebStack">
paulb@327 50
<h3>WebStack API - Path Methods in Transaction Objects</h3>
paulb@357 51
<p>WebStack provides the following transaction methods for inspecting
paulb@357 52
path
paulb@327 53
information:</p>
paulb@327 54
<dl>
paulb@327 55
  <dt><code>get_path</code></dt>
paulb@357 56
  <dd>This gets the entire path of a resource including parameter
paulb@357 57
information (as described in <a href="parameters.html">"Request
paulb@357 58
Parameters and Uploads"</a>).</dd>
paulb@327 59
  <dt><code>get_path_without_query</code></dt>
paulb@357 60
  <dd>This gets the entire path of a resource but without any parameter
paulb@357 61
information.</dd>
paulb@327 62
</dl>
paulb@327 63
</div>
paulb@357 64
<h2>Query Strings</h2>
paulb@335 65
<p>Sometimes, a "query string" will be provided as part of a URL; for
paulb@335 66
example:</p>
paulb@335 67
<pre>http://www.boddie.org.uk/application?param1=value1</pre>
paulb@357 68
<p>The question mark character marks the beginning of the query string
paulb@357 69
which
paulb@357 70
contains encoded parameter information; such information and its
paulb@357 71
inspection
paulb@335 72
is discussed in <a href="parameters.html">"Request Parameters and
paulb@335 73
Uploads"</a>.</p>
paulb@357 74
<h2>More About Paths</h2>
paulb@357 75
<ul>
paulb@357 76
  <li><a href="path-info.html">Paths To and Within Applications</a></li>
paulb@357 77
  <li><a href="path-design.html">Path Design and Interpretation</a></li>
paulb@357 78
  <li><a href="path-info-support.html">Path Info Support in Server
paulb@357 79
Environments</a></li>
paulb@357 80
</ul>
paulb@327 81
</body>
paulb@327 82
</html>