[Gd-chatter] r11611 - in trunk/libraries/network/koala: sources/koala sources/xml-rpc-common www/koala
cgay at gwydiondylan.org
cgay at gwydiondylan.org
Mon Jan 7 14:22:59 CET 2008
Author: cgay
Date: Mon Jan 7 14:22:57 2008
New Revision: 11611
Modified:
trunk/libraries/network/koala/sources/koala/dsp.dylan
trunk/libraries/network/koala/sources/koala/library.dylan
trunk/libraries/network/koala/sources/koala/response.dylan
trunk/libraries/network/koala/sources/koala/server.dylan
trunk/libraries/network/koala/sources/koala/vhost.dylan
trunk/libraries/network/koala/sources/xml-rpc-common/library.dylan
trunk/libraries/network/koala/www/koala/dsp.html
Log:
Job: koala
More little cleanups, including suppressing/fixing some compiler warnings.
Modified: trunk/libraries/network/koala/sources/koala/dsp.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/dsp.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/dsp.dylan Mon Jan 7 14:22:57 2008
@@ -436,11 +436,12 @@
define method parse-tag-arg
(name, arg :: <string>, type == <boolean>) => (value :: <boolean>)
select (arg by string-equal?)
- "true", "yes", "#t" => #t;
- "false", "no", "#f" => #f;
+ "true", "yes", "on", "#t" => #t;
+ "false", "no", "off", "#f" => #f;
otherwise =>
log-warning("Tag call argument %= should be a boolean value such as"
- " true/false or yes/no. false will be used.", arg);
+ " true/false, yes/no, or on/off. false will be used.",
+ arg);
#f;
end;
end;
@@ -537,10 +538,11 @@
format(stream, " %s", name))
end,
exclude: exclude);
-end;
+end function show-tag-call-attributes;
define function get-tag-call-attribute
- (attr :: <object>, #key as: type :: <type>, test = \=) => (attribute-value :: <object>)
+ (attr :: <object>, #key as: type :: <type>, test = \=)
+ => (attribute-value :: <object>)
block (return)
map-tag-call-attributes(method (name, value)
if (test(name, attr))
@@ -584,7 +586,8 @@
end;
define method as
- (class :: subclass(<string>), call :: <tag-call>) => (s :: <string>)
+ (class :: subclass(<string>), call :: <tag-call>)
+ => (s :: <string>)
with-output-to-string(out)
format(out, "<%s:%s", call.prefix, call.name);
for (arg in call.arguments,
@@ -608,8 +611,8 @@
// This is as-yet unused.
// Pretty sure it was originally put here for error reporting purposes.
constant slot source :: false-or(<locator>) = #f, init-keyword: #"source";
- // slot mod-date; ---*** TODO
-end;
+ // slot mod-date; ---*** TODO
+end class <dsp-template>;
define method add-entry!
(tmplt :: <dsp-template>, entry :: <object>)
Modified: trunk/libraries/network/koala/sources/koala/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/library.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/library.dylan Mon Jan 7 14:22:57 2008
@@ -347,8 +347,11 @@
//use ssl-sockets;
use xml-parser,
prefix: "xml$";
- use xml-rpc-common;
- use win32-kernel, import: { LoadLibrary, FreeLibrary };
+ use xml-rpc-common,
+ // TODO: remove base64 code from xml-rpc-common
+ exclude: { base64-decode, base64-encode };
+ use win32-kernel,
+ import: { LoadLibrary, FreeLibrary };
use base64;
use command-line-parser;
end module httpi;
Modified: trunk/libraries/network/koala/sources/koala/response.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/response.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/response.dylan Mon Jan 7 14:22:57 2008
@@ -9,7 +9,9 @@
// Exported
//
define open primary class <response> (<object>)
- slot get-request :: <request>, required-init-keyword: #"request";
+
+ constant slot get-request :: <request>,
+ required-init-keyword: #"request";
// The output stream is created lazily so that the user has the opportunity to
// set properties such as stream type (e.g., binary or text) and buffering
@@ -19,7 +21,8 @@
// Headers to send with the response.
// @see add-header
- slot response-headers :: <header-table>, required-init-keyword: #"headers";
+ constant slot response-headers :: <header-table>,
+ required-init-keyword: #"headers";
slot response-code :: <integer> = 200;
slot response-message :: <string> = "OK";
@@ -28,13 +31,15 @@
// Whether or not this is a buffered response.
// @see output-stream
- constant slot buffered? :: <boolean> = #t;
-end;
+ constant slot response-buffered? :: <boolean> = #t;
+
+end class <response>;
// Exported
//
define method add-header
- (response :: <response>, header :: <string>, value :: <object>, #key if-exists? = #"append")
+ (response :: <response>, header :: <string>, value :: <object>,
+ #key if-exists? = #"append")
if (headers-sent?(response))
raise(<koala-api-error>,
"Attempt to add a %s header after headers have already been sent.",
@@ -53,12 +58,15 @@
define method output-stream
(response :: <response>) => (stream :: <stream>)
response.%output-stream
- | begin
+ | if (response-buffered?(response))
// The user can override this if they do it before writing to the
// output stream.
set-content-type(response, default-dynamic-content-type(*virtual-host*),
if-exists?: #"ignore");
response.%output-stream := make(<string-stream>, direction: #"output");
+ else
+ signal(make(<koala-error>,
+ format-string: "unbuffered responses aren't supported yet."));
end
end;
@@ -79,7 +87,8 @@
raise(<koala-api-error>,
"Attempt to set the Content-Type header after reply has begun to be sent.");
else
- add-header(response.response-headers, "Content-Type", content-type, if-exists?: if-exists?);
+ add-header(response.response-headers, "Content-Type", content-type,
+ if-exists?: if-exists?);
end;
end;
Modified: trunk/libraries/network/koala/sources/koala/server.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/server.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/server.dylan Mon Jan 7 14:22:57 2008
@@ -66,8 +66,7 @@
slot connections-accepted :: <integer> = 0; // Connections accepted
constant slot user-agent-stats :: <string-table> = make(<string-table>);
- constant class slot startup-date :: <date> = current-date();
-end;
+end class <server>;
define sealed method make
(c == <server>, #rest keys, #key) => (server :: <server>)
Modified: trunk/libraries/network/koala/sources/koala/vhost.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/vhost.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/vhost.dylan Mon Jan 7 14:22:57 2008
@@ -58,6 +58,12 @@
// TODO:
//slot allow-cgi?, etc ...
+end class <directory-spec>;
+
+// prevent warnings until these are used by the config stuff
+begin
+ follow-symlinks?-setter;
+ allow-directory-listing?-setter;
end;
@@ -171,6 +177,15 @@
end class <virtual-host>;
+// prevent warnings until these are used by the config stuff
+begin
+ default-documents-setter;
+ default-static-content-type-setter;
+ default-dynamic-content-type-setter;
+ generate-server-header?-setter;
+ auto-register-pages?;
+ auto-register-pages?-setter;
+end;
define method initialize
(vhost :: <virtual-host>, #key name, #all-keys)
Modified: trunk/libraries/network/koala/sources/xml-rpc-common/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/xml-rpc-common/library.dylan (original)
+++ trunk/libraries/network/koala/sources/xml-rpc-common/library.dylan Mon Jan 7 14:22:57 2008
@@ -7,9 +7,12 @@
define library xml-rpc-common
use common-dylan;
- use io;
- use system; // for date module
- use xml-parser;
+ use io,
+ import: { streams, format };
+ use system,
+ import: { date };
+ use xml-parser,
+ import: { xml-parser };
use dylan-basics;
export xml-rpc-common;
end;
@@ -18,7 +21,6 @@
use dylan;
use common-extensions, exclude: { format-to-string };
use format;
- use format-out; // for debugging only
use streams;
use date,
import: { <date>, as-iso8601-string };
Modified: trunk/libraries/network/koala/www/koala/dsp.html
==============================================================================
--- trunk/libraries/network/koala/www/koala/dsp.html (original)
+++ trunk/libraries/network/koala/www/koala/dsp.html Mon Jan 7 14:22:57 2008
@@ -237,14 +237,19 @@
<pre><xyz:tag-one/></pre>
+Note that <code>prefix</code> is optional, and defaults to the value
+of <code>name</code>.
+
<a name="tags"></a>
<h3>Tags</h3>
Tags are defined with the "define tag" macro. The syntax is:
<pre>
- define tag tag-name [in taglib-name] (method-parameters) (tag-parameters)
- tag-body
+ define [body] tag tag-name [in taglib-name]
+ (method-parameters)
+ (tag-parameters)
+ ...code...
end;
</pre>
@@ -350,8 +355,7 @@
<tr>
<td width="2%"> </td>
<td width="98%">
- The name of the taglib the tag should be added to. If not specified, it
- defaults to <code>"dsp"</code>.
+ The name of the taglib the tag should be added to.
<p>
</td>
</tr>
@@ -415,19 +419,24 @@
<span class="defheader">Description</span>
<blockquote>
- Defines a new tag named <span class="param">tag-name</span> in the <span
- class="param">taglib-name</span> tag library. For simple DSP tags with no body
- elements, the <span class="param">body</span> code normally just does output to the
- current output stream, generating dynamic output in place of the literal tag call in the
- source file. Tags that have body elements may additionally want to setup state for
- nested tags to use. This may be done, for example, through the use of dynamically bound
- thread variables or storing information in the session or page context.
+ Defines a new tag named <span class="param">tag-name</span> in the
+ <span class="param">taglib-name</span> tag library. For simple DSP
+ tags with no body elements, the <span class="param">body</span> code
+ normally just does output to the output stream of the current
+ response, generating dynamic output in place of the literal tag call
+ in the source file. Tags that have body elements may additionally
+ want to setup state for nested tags to use. This may be done, for
+ example, through the use of dynamically bound thread variables or
+ storing information in the session or page context.
<p>
- When the DSP engine invokes the tag to generate dynamic content it passes arguments that
- match <span class="param">method-parameters</span>. <span
- class="param">tag-call-parameters</span> receive arguments specified in the tag call, in
- the DSP source file, after they have been parsed to the specified types.
+ When the DSP engine invokes the tag to generate dynamic content it
+ passes arguments that match <span
+ class="param">method-parameters</span>. <span
+ class="param">tag-call-parameters</span> receive arguments specified
+ in the tag call, in the DSP source file, after they have been parsed
+ to the specified types.
+
</blockquote>
<span class="defheader">Examples</span>
More information about the chatter
mailing list