WebStack

docs/paths.html

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