You know Martin, I was all set to reply with two or three points that I
THOUGHT were valid against this, but as I started writing them up (I think
three or four messages began and aborted!) I decided what you've done I
actually DO like!  :)

The one comment that remains is this... The approach I was trying to take
with my code was, if you make the assumption that the parameters I was
passing got added as <action> attributes as I intended, was a declarative
one.  I wanted to have one generic Action that would, just with some
entries in a configuration file, allow for serving objects from the file
system or a database.  My feeling is that Struts is already largely
declarative in nature, so why not stick with that model?

The code you've written certainly doesn't preclude that, but it doesn't
address it either.  So, maybe I can suggest a little bit of a hybrid
approach...

What I'm thinking is what if we still added some or all of the parameters
my code uses to the <action> mappings (mostly optional of course)... One
new attribute would also be a StreamInfo implementation class name which
would be instantiated in the Action... The class gets instantiated in your
getStreamInfo() method of the Action, then everything proceeds as you've
done.

Doing this, we would have the ability to, for instance, have a
DatabaseStreamInfo class that knows how to read the database-relevant
attributes from the ActionMapping and return the input stream.  Likewise
for serving from the file system.  I guess what I'm actually get at is a
generic implementation of your abstract DownloadAction that can work based
on Action mapping attributes, but someone could of course still implement
their own version as well.

What are your thoughts about that?

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, September 21, 2004 1:51 am, Martin Cooper said:
> I'd been thinking about something in between. How about an Action that
> does all the drudge work, but leaves the details to the implementor?
> Something, perhaps, like this:
>
> http://www.apache.org/~martinc/struts/DownloadAction.java
>
> This provides easy solutions for downloading files from the file system,
> resources from a web app, or a completely custom solution, if you don't
> like either of those.
>
> --
> Martin Cooper
>
>
> On Mon, 20 Sep 2004, Craig McClanahan wrote:
>
>> On Mon, 20 Sep 2004 09:57:00 +0200, Reinhard Nägele
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Streaming files back to the reponse is really nothing special, and it's
>>> not exactly a Struts-specific thing. A simple Booch utitlity class
>>> would
>>> serve the purpose.
>>
>> I agree with Reinhard's reasons that something this specific to
>> particular data access mechanisms might not be appropriate as a part
>> of the core framework.  That being said, questions about downloading
>> binary data come up often enough that something like this would make a
>> dandy example application.
>>
>>>
>>> Reinhard
>>>
>>
>> Craig
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to