1 //
2 // Copyright (c) 2006, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 15 Mar 06 Andy Frank Creation
7 //
8
9 **
10 ** WebReq encapsulates a web request.
11 **
12 abstract class WebReq
13 {
14
15 //////////////////////////////////////////////////////////////////////////
16 // Public
17 //////////////////////////////////////////////////////////////////////////
18
19 **
20 ** Get the WebService managing the request.
21 **
22 abstract WebService service()
23
24 **
25 ** The HTTP request method in uppercase. Example: GET, POST, PUT.
26 **
27 abstract Str method()
28
29 **
30 ** The HTTP version of the request.
31 **
32 abstract Version version()
33
34 **
35 ** The request URI.
36 **
37 ** Examples:
38 ** http://www.foo.com/a/b/c
39 ** http://www.foo.com/a?q=bar
40 **
41 abstract Uri uri()
42
43 **
44 ** The prefixUri is the portion of the request URI controlled
45 ** by the web server. A prefixUri always ends with a trailing
46 ** slash.
47 **
48 ** uri == prefixUri + suffixUri
49 **
50 ** Examples:
51 ** uri: http://www.foo.com/a/b/c
52 ** prefixUri: http://www.foo.com/a/
53 ** suffixUri: b/c
54 **
55 ** uri: http://www.foo.com/a/b/c
56 ** prefixUri: http://www.foo.com/
57 ** suffixUri: a/b/c
58 **
59 ** uri: http://www.foo.com/a/b/c?q=bar
60 ** prefixUri: http://www.foo.com/a/b/
61 ** suffixUri: c?q=bar
62 **
63 abstract Uri prefixUri()
64
65 **
66 ** The suffixUri is the portion of the request URI not
67 ** controlled by the web server. The suffixUri will always
68 ** starts after the trailing slash of the prefixUri.
69 **
70 ** uri == prefixUri + suffixUri
71 **
72 ** Examples:
73 ** uri: http://www.foo.com/a/b/c
74 ** prefixUri: http://www.foo.com/a/
75 ** suffixUri: b/c
76 **
77 ** uri: http://www.foo.com/a/b/c
78 ** prefixUri: http://www.foo.com/
79 ** suffixUri: a/b/c
80 **
81 ** uri: http://www.foo.com/a/b/c?q=bar
82 ** prefixUri: http://www.foo.com/a/b/
83 ** suffixUri: c?q=bar
84 **
85 abstract Uri suffixUri()
86
87 **
88 ** Map of HTTP request headers. This Map is readonly
89 ** and case insenstive (see `sys::Map.caseInsensitive`).
90 **
abstract Str:Str headers()
92
93 **
94 ** The UserAgent for this request or null if the
95 ** "User-Agent" header was not specified in the request.
96 **
97 abstract UserAgent userAgent()
98
99 **
100 ** Get the key/value pairs of the form data. If the request
101 ** content type is "application/x-www-form-urlencoded", then the
102 ** first time this method is called the request content is read
103 ** and parsed using `sys::Uri.decodeQuery`. If the content
104 ** type is not "application/x-www-form-urlencoded" this method
105 ** returns null.
106 **
107 abstract Str:Str form()
108
109 **
110 ** The InStream for this request.
111 **
112 abstract InStream in()
113
114 **
115 ** The Resource resolved by the `uri`.
116 **
117 Resource resource { internal set; }
118
119 **
120 ** Stash allows you to stash objects on the WebReq object
121 ** in order to pass data b/w Weblets on the same request.
122 **
123 abstract Str:Obj stash()
124
125 }