cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@upaya.co.uk>
Subject Re: Write binary data to output stream from flow
Date Fri, 18 Feb 2005 10:20:09 GMT
Bart Molenkamp wrote:
> Yes, it makes even better sense. 
> 
> Would such a more generic, JXPath oriented stream reader be a valuable
> contribution to Cocoon?

To me it would. Anyone else think so, or have some reasons against?

In fact, the object you pass to the reader (via the XPath string), 
should not be the input stream, but some object that has a 
getInputStream method. That would make better sense. And the reader 
could check to see if the object has a getMimeType() method, and if so, 
get the mime type from that. It should also be possible to configure the 
mime type in the component definition or via the <map:read 
mime-type="xxx"> approach, or however the ResourceReader currently works.

Regards, Upayavira

>>-----Original Message-----
>>From: Upayavira [mailto:uv@upaya.co.uk]
>>Sent: Friday, February 18, 2005 11:06 AM
>>To: dev@cocoon.apache.org
>>Subject: Re: Write binary data to output stream from flow
>>
>>Bart Molenkamp wrote:
>>
>>>Ok, sorry, I didn't understand you but now it makes perfect sense.
>>>Thanks for your advise!
>>
>>Well, I had a chance to express myself more clearly, and think it
>>through a bit more.
>>
>>Basically, what you're doing is implementing another way to connect
> 
> the
> 
>>controller to the view, when the view is pretty simple.
>>
>>I would tend to implement this as a custom reader, actually, with code
>>like:
>>
>><map:components>
>>   <map:readers>
>>     <map:reader name="stream" class=".....">
>>       <stream-name>/stream</stream-name>
>>       <mime-type-name>/mimeType</mime-type-name>
>>     </map:reader>
>>   </map:readers>
>></map:components>
>>
>><map:match pattern="my-stream-uri">
>>   <map:read type="stream"/>
>></map:match>
>>
>>That way, you're configuring the reader to know where in the flow
>>business objects to get the stream and the mime type. As the context
>>object from flow comes back as just an Object (presumably could be
> 
> some
> 
>>kind of javascript object as well), you would do well to use JXPath to
>>get at the values, hence specifying the names of these values as XPath
>>expressions.
>>
>>You end up with something more generic component that way that isn't
>>specifically targetted at your problem.
>>
>>Make sense?
>>
>>Regards, Upayavira

Mime
View raw message