cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Rolappe" <m_rola...@web.de>
Subject AW: reading binary stream into xsp page
Date Thu, 12 Feb 2004 10:41:31 GMT
I think they understood that you were getting a byte[] field.

however, you cannot 'render the binary stream correctly to the page', i.e.
you cannot simply embed an image into an html page as a binary stream. as
was mentioned, you reference image(s/ streams) via URLs. you can of course
have that URL be handled by an XSP that emits the data you get from the db
as e.g. a gif image (image/gif), if it was a gif stream.

regarding the text: when getting the byte stream you probably don't know
what encoding the text is in. and it might differ from the encoding used by
the XSP. thus, the text might be parsed and output incorrectly (the nulls
you get are the second bytes of each of the multi-byte chars).

> -----Ursprungliche Nachricht-----
> Von: users-return-62805-m_rolappe=web.de@cocoon.apache.org
> [mailto:users-return-62805-m_rolappe=web.de@cocoon.apache.org]Im Auftrag
> von beyaNet Consultancy
> Gesendet: Donnerstag, 12. Februar 2004 11:30
> An: users@cocoon.apache.org
> Betreff: Re: reading binary stream into xsp page
>
>
> lg,
> you have not understood what I am doing. I am reading a byte[] field
> from postgreSQL into my xsp page:
>
> Artist newArt = new Artist();
> byte[] binStream = newArt.getArtistPhoto1();
>
> What I simply want to know is this, how do I render the binary stream
> correctly to the page if:
>
> 1. binStream is an image or
> 2. binStream is a text document
>
> what do I need to do in xsp to correctly display the binary stream as
> an image or as text?
>
> many thanks in advance
>
>
> On 12 Feb 2004, at 10:10, Leszek Gawron wrote:
>
> > On Thu, Feb 12, 2004 at 09:22:29AM +0000, beyaNet Consultancy wrote:
> >> Eduard,
> >> I tried your recommendation and it worked partly but the output to the
> >> screen is incorrect. I am getting &#0;t&#0;h&#0;i&#0;s&#0;
written to
> >> the screen instead of plain text with out the &#0; being written to
> >> the
> >> screen as well. How do I deal with this? And if the output stream was
> >> an image or audio how would I deal with those outputs as well? for
> >> instance if:
> >>
> >> 1. byte[] text = newArt.getArtistPhoto1(); allows me to do
> >> <xsp:expr>new String(text)</xsp:expr> in my xsp page, how would
I deal
> >> with:
> >>
> >> 2. byte[] image = newArt.getArtistPhoto1(); or
> >>
> >> 3. byte[] audio = newArt.getArtistPhoto1();
> > you got it all wrong right now. If you (a user working with the
> > browser)
> > request a page that contains both text and graphics then this content
> > is
> > requested separately. So it means that first the html code gets
> > fetched. After
> > that every <img> tag is being parsed and fetched in separate request.
> > When the
> > browser has all the files needed it renders the page.
> >
> > You do not need to include any binary data in your html code produced
> > by xsp.
> >
> > And the &#0; ? If you try to insert binary content into xml it gets
> > escaped
> > (everything that is not "text" ).
> >
> > 	lg
> > --
> >             __
> >          | /  \ |        Leszek Gawron            //  \\
> >         \_\\  //_/       ouzo@wlkp.org           _\\()//_
> >          .'/()\'.     Phone: +48(501)720812     / //  \\ \
> >           \\  //  recursive: adj; see recursive  | \__/ |
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message