Index: xotcl/library/actiweb/SendStrategy.xotcl =================================================================== diff -u -N -rf7894d9be99a8da3a04218abcdb9bd46b6d625c8 -r435b41481fb51bf000ebe736d8574fefbeec1710 --- xotcl/library/actiweb/SendStrategy.xotcl (.../SendStrategy.xotcl) (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) +++ xotcl/library/actiweb/SendStrategy.xotcl (.../SendStrategy.xotcl) (revision 435b41481fb51bf000ebe736d8574fefbeec1710) @@ -1,38 +1,51 @@ -# $Id: SendStrategy.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# $Id: SendStrategy.xotcl,v 1.2 2005/09/09 21:07:23 neumann Exp $ + package provide xotcl::actiweb::sendStrategy 0.8 + +package require XOTcl + # # some simple sending strategy classes -- to be used as mixins # for web objects # -Class SendStrategy -SendStrategy abstract instproc send {httpWrk string} +namespace eval ::xotcl::actiweb::sendStrategy { + namespace import ::xotcl::* -# -# send the response given from the place as plain text -# -Class Send=PlainString -superclass SendStrategy -Send=PlainString instproc send {httpWrk string} { - $httpWrk sendMsg $string text/plain -} + Class SendStrategy + SendStrategy abstract instproc send {httpWrk string} -# -# send the response given from the place with content -# type of the obj, if it exists -# -Class Send=TypedString -superclass SendStrategy -Send=TypedString instproc send {httpWrk string} { - $httpWrk sendMsg $string [my set contentType] -} - -# -# send file specified in obj's instvar filename -# -Class Send=File -superclass SendStrategy -Send=File instproc send {httpWrk {response ""}} { - if {[my exists contentType]} { - $httpWrk sendFile [my set filename] [my set contentType] - } else { - $httpWrk sendFile [my set filename] "" + # + # send the response given from the place as plain text + # + Class Send=PlainString -superclass SendStrategy + Send=PlainString instproc send {httpWrk string} { + $httpWrk sendMsg $string text/plain } + + # + # send the response given from the place with content + # type of the obj, if it exists + # + Class Send=TypedString -superclass SendStrategy + Send=TypedString instproc send {httpWrk string} { + $httpWrk sendMsg $string [my set contentType] + } + + # + # send file specified in obj's instvar filename + # + Class Send=File -superclass SendStrategy + Send=File instproc send {httpWrk {response ""}} { + if {[my exists contentType]} { + $httpWrk sendFile [my set filename] [my set contentType] + } else { + $httpWrk sendFile [my set filename] "" + } + } + + namespace export \ + SendStrategy Send=PlainString Send=TypedString Send=File } + +namespace import ::xotcl::actiweb::sendStrategy::*