1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/methods.html Sun Apr 10 21:11:25 2005 +0000
1.3 @@ -0,0 +1,91 @@
1.4 +<?xml version="1.0" encoding="iso-8859-1"?>
1.5 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1.6 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.7 +<html xmlns="http://www.w3.org/1999/xhtml">
1.8 +<head>
1.9 + <title>Request Methods</title>
1.10 + <meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.11 + <link href="styles.css" rel="stylesheet" type="text/css" />
1.12 +</head>
1.13 +
1.14 +<body>
1.15 +<h1>Request Methods</h1>
1.16 +
1.17 +<p>In order for an application to behave in the right way when someone sends
1.18 +a request into it, the application must take into consideration the type of
1.19 +request being sent. The type of request is typically referred to as the
1.20 +"request method" and indicates the kind of operation the user is attempting
1.21 +to perform.</p>
1.22 +
1.23 +<h2>Common Request Methods</h2>
1.24 +
1.25 +<p>The following table summarises the most common methods defined for Web
1.26 +applications in the HTTP and WebDAV specifications:</p>
1.27 +
1.28 +<table border="1" cellspacing="0" cellpadding="5">
1.29 + <tbody>
1.30 + <tr>
1.31 + <th>Method</th>
1.32 + <th>Type of Operation</th>
1.33 + </tr>
1.34 + <tr>
1.35 + <td>GET</td>
1.36 + <td>Retrieve a Web page or resource</td>
1.37 + </tr>
1.38 + <tr>
1.39 + <td>POST</td>
1.40 + <td>Present information to an application - for example, submission of
1.41 + fields in a form</td>
1.42 + </tr>
1.43 + <tr>
1.44 + <td>PUT</td>
1.45 + <td>Upload a new Web page or resource</td>
1.46 + </tr>
1.47 + <tr>
1.48 + <td>DELETE</td>
1.49 + <td>Delete a Web page or resource</td>
1.50 + </tr>
1.51 + <tr>
1.52 + <td>PROPFIND</td>
1.53 + <td>List resources on a server or in an application</td>
1.54 + </tr>
1.55 + </tbody>
1.56 +</table>
1.57 +
1.58 +<p>Most applications will at least need to support the GET request method in
1.59 +order to support some kind of user experience, and those which employ forms
1.60 +in Web pages will most probably want to support the POST request method,
1.61 +too.</p>
1.62 +
1.63 +<div class="WebStack">
1.64 +<h3>WebStack API - Discovering the Request Method</h3>
1.65 +
1.66 +<p>Transaction objects provide the following method for discovering the
1.67 +request method:</p>
1.68 +<dl>
1.69 + <dt><code>get_request_method</code></dt>
1.70 + <dd>This returns the request method being used in the request being
1.71 + handled.</dd>
1.72 +</dl>
1.73 +</div>
1.74 +
1.75 +<h2>Rejecting Certain Request Methods</h2>
1.76 +
1.77 +<p>Not all request methods are appropriate to every application. Should a
1.78 +request be received which uses a method not supported by an application, the
1.79 +most appropriate way of responding is to signal this condition to the sender
1.80 +of the request. HTTP provides a response code to communicate just this kind
1.81 +of condition - "405 Method Not Allowed".</p>
1.82 +
1.83 +<div class="WebStack">
1.84 +<h3>WebStack API - Signalling Unsupported Methods</h3>
1.85 +
1.86 +<p>Transaction objects provide the <code>set_response_code</code> method (as
1.87 +described in <a href="responses.html">"Responses and Presentation"</a>) to
1.88 +communicate critical information on the success or failure of a request. In
1.89 +this case, we would use this method on a transaction object
1.90 +<code>trans</code> as follows:</p>
1.91 +<pre>trans.set_response_code(405)</pre>
1.92 +</div>
1.93 +</body>
1.94 +</html>