Hi,
The recently announced cool tutorial on using Zinc made me read the Zinc code
in a bit more detail. I must admit, it makes for a nice read.
In the process, I stumbled across:
knownHTTPMethods
^ #(
"Standard HTTP 1.1 Verbs"
GET PUT POST DELETE HEAD
TRACE OPTIONS CONNECT PATCH
"WebDAV verbs"
PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK)
I would propose to model these as classes (inheriting from ZnRequestMethod).
If we would have such a hierarchy, then the following code:
ZnSingleThreadedServer>>handleRequest: request
...
request method = #HEAD
ifTrue: [ response clearEntity ].
Could become something like:
ZnSingleThreadedServer>>handleRequest: request
...
request method clearEntityForSingleThreadedServerResponse: response
ZnRequestMethod>>clearEntityForSingleThreadedServer: aResponse
"nothing"
ZnHeadRequestMethod>>clearEntityForSingleThreadedServer: aResponse
aResponse clearEntity
What do you think?
Cheers,
Doru
--
www.tudorgirba.com
"Not knowing how to do something is not an argument for how it cannot be done."