From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_http_servlet_8cpp_source.html | 340 ++++++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 Doc/doxygen/html/_http_servlet_8cpp_source.html (limited to 'Doc/doxygen/html/_http_servlet_8cpp_source.html') diff --git a/Doc/doxygen/html/_http_servlet_8cpp_source.html b/Doc/doxygen/html/_http_servlet_8cpp_source.html new file mode 100644 index 0000000..5382380 --- /dev/null +++ b/Doc/doxygen/html/_http_servlet_8cpp_source.html @@ -0,0 +1,340 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/NetEx/HttpServlet.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
HttpServlet.cpp
+
+
+Go to the documentation of this file.
1 /* Project nGenEx
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: NetEx.lib
+
6  FILE: HttpServlet.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Network Server Pump for HTTP Server
+
13 */
+
14 
+
15 
+
16 #include "MemDebug.h"
+
17 #include "HttpServlet.h"
+
18 #include "NetLayer.h"
+
19 
+
20 #include <stdlib.h>
+
21 #include <stdio.h>
+
22 #include <ctype.h>
+
23 
+
24 // +-------------------------------------------------------------------+
+
25 
+ +
27  : session(0)
+
28 { }
+
29 
+ +
31 { }
+
32 
+
33 // +--------------------------------------------------------------------+
+
34 
+
35 bool
+ +
37 {
+
38  bool result = false;
+
39 
+
40  switch (request.Method()) {
+ +
42  result = DoGet(request, response);
+
43  break;
+
44 
+ +
46  result = DoPost(request, response);
+
47  break;
+
48 
+ +
50  result = DoHead(request, response);
+
51  break;
+
52 
+
53  default:
+
54  break;
+
55  }
+
56 
+
57  return result;
+
58 }
+
59 
+
60 // +--------------------------------------------------------------------+
+
61 
+
62 bool
+ +
64 {
+
65  return false;
+
66 }
+
67 
+
68 bool
+ +
70 {
+
71  return DoGet(request, response);
+
72 }
+
73 
+
74 bool
+ +
76 {
+
77  if (DoGet(request, response)) {
+
78  int len = response.Content().length();
+
79 
+
80  char buffer[256];
+
81  sprintf(buffer, "%d", len);
+
82  response.SetHeader("Content-Length", buffer);
+
83  response.SetContent("");
+
84 
+
85  return true;
+
86  }
+
87 
+
88  return false;
+
89 }
+
90 
+
91 // +--------------------------------------------------------------------+
+
92 // +--------------------------------------------------------------------+
+
93 // +--------------------------------------------------------------------+
+
94 
+ +
96 {
+
97  id = GenerateUniqueID();
+ +
99 }
+
100 
+ +
102 {
+ +
104 }
+
105 
+
106 // +--------------------------------------------------------------------+
+
107 
+
108 Text
+
109 HttpSession::GetAttribute(const char* name)
+
110 {
+ +
112  while (++iter) {
+
113  HttpParam* p = iter.value();
+
114 
+
115  if (p->name == name)
+
116  return p->value;
+
117  }
+
118 
+
119  return Text();
+
120 }
+
121 
+
122 void
+
123 HttpSession::SetAttribute(const char* name, const char* value)
+
124 {
+ +
126  while (++iter) {
+
127  HttpParam* p = iter.value();
+
128 
+
129  if (p->name == name) {
+
130  p->value = value;
+
131  return;
+
132  }
+
133  }
+
134 
+
135  HttpParam* param = new(__FILE__,__LINE__) HttpParam(name, value);
+
136  if (param)
+
137  attributes.append(param);
+
138 }
+
139 
+
140 void
+
141 HttpSession::DelAttribute(const char* name)
+
142 {
+ +
144  while (++iter) {
+
145  HttpParam* p = iter.value();
+
146 
+
147  if (p->name == name) {
+
148  delete iter.removeItem();
+
149  return;
+
150  }
+
151  }
+
152 }
+
153 
+
154 // +--------------------------------------------------------------------+
+
155 
+
156 int
+ +
158 {
+ +
160  while (++iter) {
+
161  HttpParam* p = iter.value();
+
162 
+
163  if (p->name == name) {
+
164  int result = ::atoi(p->value.data());
+
165  return result;
+
166  }
+
167  }
+
168 
+
169  return 0;
+
170 }
+
171 
+
172 void
+
173 HttpSession::SetIntAttribute(const char* name, int value)
+
174 {
+
175  char buf[32];
+
176  sprintf(buf, "%d", value);
+
177 
+ +
179  while (++iter) {
+
180  HttpParam* p = iter.value();
+
181 
+
182  if (p->name == name) {
+
183  p->value = buf;
+
184  return;
+
185  }
+
186  }
+
187 
+
188  HttpParam* param = new(__FILE__,__LINE__) HttpParam(name, buf);
+
189  if (param)
+
190  attributes.append(param);
+
191 }
+
192 
+
193 void
+ +
195 {
+
196  DelAttribute(name);
+
197 }
+
198 
+
199 // +--------------------------------------------------------------------+
+
200 
+
201 Text
+ +
203 {
+
204  char unique[17];
+
205 
+
206  for (int i = 0; i < 16; i++) {
+
207  char c = rand() % 25 + 'a';
+
208  unique[i] = c;
+
209  }
+
210 
+
211  unique[16] = 0;
+
212  return unique;
+
213 }
+
214 
+
215 // +--------------------------------------------------------------------+
+
216 
+
217 void
+ +
219 {
+ +
221 }
+
222 
+
223 
+
+
+ + + + -- cgit v1.1