You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by andi <my...@yahoo.com> on 2003/02/14 13:47:28 UTC

dynamic served image files

hi,

i want to serve dynamically created imagefiles (wbmps
in my case) from the cocoon-pipeline. i wrote an xsp
with helperclass and tried to get the output of it,
but i don't know how. i thought about taking <map:read
..> but i don't know how to access a dynamic source..

one possibilty is to write the image to the filesystem
and serve a link to it dynamically but as i normally
need the image only once i'd rather have it served
"directly" (analog to the svg2jpeg sample included in
the cocoon samples)

has anyone done anything like that? do i have to write
my own transformerand serializer??

thanks for any help.

andi.



__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


AW: dynamic served image files

Posted by Marco Rolappe <m_...@web.de>.
hi andi,

you didn't tell what the source for the dynamically created wbmp image is.

if it's based on xml input, you could write a corresponding Serializer (have
a look at the respective sources).

another option is to write a Reader (which doesn't actually need to read
something ;-).

third alternative is to completely separate this into its own Servlet.

in all cases the general scheme is the same; create your data (wbmp image)
and write it to the output stream. in the servlet case you get that stream
from the HttpServletResponse. in the cocoon (serializer/reader) case you
could get the respective response object from the Environment, from which
you could then get the OutputStream to write to. fortunately you don't have
to do this, since the OutputStream is handed to you via setOutputStream().
in case of inheriting from AbstractReader you don't even have to handle
this, but access the handed stream via 'out'.

quick example (Reader case), for which I assume you have the image generated
by java code, which contains a method that writes the result to an
OutputStream:

<code>
// imports omitted

public class DynWbmpReader extends AbstractReader
{
	/** get the MIME type of the generated output */
	public String getMimeType ()
	{
		return ("image/vnd.wap.wbmp");
	}


	public void generate () throws IOException, ProcessingException
	{
		YourDynWbmpClass.renderToStream (out);
	}
}
</code>

HTH

> -----Ursprungliche Nachricht-----
> Von: cocoon-users-return-46665-m_rolappe=web.de@xml.apache.org
> [mailto:cocoon-users-return-46665-m_rolappe=web.de@xml.apache.org]Im
> Auftrag von andi
> Gesendet: Freitag, 14. Februar 2003 13:47
> An: cocoon-users@xml.apache.org
> Betreff: dynamic served image files
>
>
> hi,
>
> i want to serve dynamically created imagefiles (wbmps
> in my case) from the cocoon-pipeline. i wrote an xsp
> with helperclass and tried to get the output of it,
> but i don't know how. i thought about taking <map:read
> ..> but i don't know how to access a dynamic source..
>
> one possibilty is to write the image to the filesystem
> and serve a link to it dynamically but as i normally
> need the image only once i'd rather have it served
> "directly" (analog to the svg2jpeg sample included in
> the cocoon samples)
>
> has anyone done anything like that? do i have to write
> my own transformerand serializer??
>
> thanks for any help.
>
> andi.
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>