Index: [Article Count Order] [Thread]

Date:  Tue, 19 Mar 2002 19:34:03 -0500
From:  David Corbin <dcorbin@imperitek.com>
Subject:  [webricken:56] Re: request attributes and handler creation
To:  webricken@notwork.org
Message-Id:  <3C97D8FB.8090306@imperitek.com>
References:  <000b01c1ce75$b56fe7f0$85222fc0@sarion.co.jp>	<3C967342.6040204@imperitek.com> <20020320.063519.103024541.gotoyuzo@kotetsu.does.notwork.org>
X-Mail-Count: 00056

GOTOU Yuuzou wrote:

>In message <3C967342.6040204@imperitek.com>,
> `David Corbin <dcorbin@imperitek.com>' wrote:
>
>>b) request attributes - I modeled this on java servlets, but there is 
>>probably a more ruby-esque way to do this.  It makes forward much more 
>>useful.
>>
>
>It is not clear for me what the name of "attribute"
>suggests in HTTP message.
>
It was modeled on the Java servlets, much like the rest of this seems to 
be.  In J2EE(servlets/JSP), "attributes" exist at four different scopes 
- Application, servlet, request, and page, if I remember correctly.

>
>HTTPRequest is a representation of the HTTP request
>messages, and I want the user-defined data to be
>managed by the user-defined containers.
>
The intent behind "attribute" is to be able to set user-data that is 
automatically get carried along with the rest of the request, and in a 
very annonymous way.  It's perfectly reasonable to expect several 
different "handlers" to need to "add or extract" data to the "request 
chain".  The only other solution I can see is to add a third argument to 
all the service, do_GET and do_PUT methods, which is nothing more than 
the Hash that I put inside the request object.

You mentioned 'the user-defined containers'.  What user-defined containers?

>>c) I modified the "handler creation".  For handlers that don't need 
>>instance data, I wanted to be able to instantiate one handler at the 
>>beginning, and have it reused- this is both an efficiency issue, and an 
>>issue of I want to "build" the handler using new() and other method 
>>calls, not by building a giant hash of options.  But you can the old 
>>style handlers continue to work just fine.
>>
>
>get_instance() is just a factory method. You can also
>make it as an instance method which returns itself.
>Have you seen httpservlet/prochandler.rb?
>
Yes, I did see it.  But it fails to address the point about *how* I want 
to create the handler.  I thought about that, but I didn't want to build 
a giant "option" hash.  Futhermore, I'd argue that option my patch 
offers is more intuitive to new users.

>
>Well, "require_path_info?" might not be necessary ;)
>
I'm not sure I fully understood that method to begin with.

>
>Does anyone have any ideas?
>--
>gotoyuzo
>
>

David