# HG changeset patch # User paulb # Date 1126044248 0 # Node ID e7963e3448d89ac612e2553a0c67f6e471b804cf # Parent 24700f67636d6c176745a850bdaef2b6eed7e9fb [project @ 2005-09-06 22:04:08 by paulb] Added headers documentation; added uploads support notes; tidied up. diff -r 24700f67636d -r e7963e3448d8 docs/developing.html --- a/docs/developing.html Tue Sep 06 22:03:41 2005 +0000 +++ b/docs/developing.html Tue Sep 06 22:04:08 2005 +0000 @@ -43,13 +43,14 @@ -
Request headers are pieces of information that describe certain aspects of a request, such as:
+The location and related query information is conveniently accessible through path information and request header parameter information. Other types of header information are made available through other WebStack API methods.
+When a Web application sends some information in a response, it +describes the content type of that information, and this is described +in the "Responses and Presentation" document. However, it is also +possible that information sent to the application is also described +using a content type, and such details may be investigated using code +similar to the following:
+ +class MyResource:+ +
def respond(self, trans):
content_type = trans.get_content_type() # returns a WebStack.Generic.ContentType object
Unfortunately, such information is not always provided by Web browsers.
+Sometimes, Web browsers describe the kinds of information that +they are willing to receive, and WebStack provides various means to +query such preferences:
+ +languages = trans.get_content_languages() # returns a list of language codes+
charsets = trans.get_content_charsets() # returns a list of character set identifiers
This information permits us to send content which matches the +expectations of the user, or at least the expectations of the user's +software.
+Various other pieces of information may be attached to the request +as headers, and such information can be accessed through the general +header access methods as described below. Each header has a particular +name which is associated with a corresponding value.
+Transaction objects provide the following methods to access request header information:
+get_headers
get_header_values
get_content_type
WebStack.Generic.ContentType
) describing the incoming request body content.get_content_languages
get_content_charsets
It should be noted that the get_headers
and get_header_values
methods
+present a slightly different view of the available header information,
+in that only a single header value is made available through the get_headers
method for each header name, whereas get_header_values
provides potentially many values for the same header name.
Request parameters are typically added to the request body when forms are
-submitted by a browser which is instructed to use the POST
request method. A Web form (in HTML) can be used to
+submitted by a browser which is instructed to use the POST
request method. A Web form (in HTML) can be used to
achieve this; for example:
<form method="POST" action="http://www.boddie.org.uk/application"> - <input name="param1" type="text" /> - <input name="param2" type="text" /> -</form>+
<form method="POST" action="http://www.boddie.org.uk/application">
<input name="param1" type="text" />
<input name="param2" type="text" />
</form>
As a consequence of this form being submitted, the following parameters will become available in the application:
@@ -54,9 +47,7 @@Some limitations exist with request body parameters: