Re: Serving arbitrary OutputStreams with Cocoon

2004-04-14 Thread Oscar Picasso

--- Ugo Cei [EMAIL PROTECTED] wrote:
 Il giorno 13/apr/04, alle 19:51, Oscar Picasso ha scritto:
 
  I guess the above approaches mean I need to use Piped streams to 
  'transform' my
  OuputStream to an InputSream. Or have you a better suggestion?
 
 Possibly, but keep in mind that you cannot write to and read from a 
 Piped stream in the same thread. Alternatively, you could use a 
 ByteArrayOtputStream if memory consumption is not an issue.
 


Thanks for your useful advice.

A ByteArrayOutputStream seems in my case more convenient.

Oscar




__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

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



Re: Serving arbitrary OutputStreams with Cocoon

2004-04-13 Thread Oscar Picasso
 I have looked at ReaderResource but it seems to read resources from the file
 system.

Oups. I had a bug in my sitemap that prevented me to use the ReaderResource
with other protocoles than file system. I think I could use ReaderResource for
what I need contrary to what I said before.




__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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



Re: Serving arbitrary OutputStreams with Cocoon

2004-04-13 Thread Geoff Howard
Oscar Picasso wrote:

Hi,

I have a Java application that can generate Postscript or PDF to OutputStreams.
I would like to be able serve these OutputStreams with Cocoon.
I have looked at ReaderResource but it seems to read resources from the file
system.
I also looked at implementing a Serializer but it needs to handle SAX events
which is not the case here.
I could also simply do it outside Cocoon by using the Servlet API but I would
prefer to stay inside Cocoon.
Any idea? 

Thanks.

Oscar
Implement a custom Reader, similar to ResourceReader and the other Readers such 
ImageReader, DatabaseReader in the database block, etc.

Geoff

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


Re: Serving arbitrary OutputStreams with Cocoon

2004-04-13 Thread Ugo Cei
Oscar Picasso wrote:
Hi,

I have a Java application that can generate Postscript or PDF to OutputStreams.
I would like to be able serve these OutputStreams with Cocoon.
I have looked at ReaderResource but it seems to read resources from the file
system.
The cleanest way would be to wrap your components with a class that 
implement the Source interface and use it directly from the ResourceReader:

  map:read src=myscheme:whatever/

You can find a detailed example in Langham  Ziegeler's book Cocoon: 
Building XML Applications (New Riders).

Alternatively, you can copypaste ResourceReader and change 
inputSource.getInputStream to myComponent.getInputStream etc.

	Ugo

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


Re: Serving arbitrary OutputStreams with Cocoon

2004-04-13 Thread Oscar Picasso
--- Geoff Howard [EMAIL PROTECTED] wrote:
[..}
 
 Implement a custom Reader, similar to ResourceReader and the other Readers
 such 
 ImageReader, DatabaseReader in the database block, etc.
 
 Geoff

and

--- Ugo Cei [EMAIL PROTECTED] wrote:
[...]
 The cleanest way would be to wrap your components with a class that 
 implement the Source interface and use it directly from the ResourceReader:
 
map:read src=myscheme:whatever/
 
 You can find a detailed example in Langham  Ziegeler's book Cocoon: 
 Building XML Applications (New Riders).
 
 Alternatively, you can copypaste ResourceReader and change 
 inputSource.getInputStream to myComponent.getInputStream etc.
 
   Ugo

Thank you both for your input. I would ask for another advice if I may.

In both cases it seems that I have to provide some input stream to my Reader or
my Source component. However the Postscript and PDF are actually sent to an
OutputStream.

I guess the above approaches mean I need to use Piped streams to 'transform' my
OuputStream to an InputSream. Or have you a better suggestion?

Oscar




__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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



Re: Serving arbitrary OutputStreams with Cocoon

2004-04-13 Thread Ugo Cei
Il giorno 13/apr/04, alle 19:51, Oscar Picasso ha scritto:

I guess the above approaches mean I need to use Piped streams to 
'transform' my
OuputStream to an InputSream. Or have you a better suggestion?
Possibly, but keep in mind that you cannot write to and read from a 
Piped stream in the same thread. Alternatively, you could use a 
ByteArrayOtputStream if memory consumption is not an issue.

	Ugo

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